-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ffc84d
commit 16afeb8
Showing
27 changed files
with
364 additions
and
774 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blank_issues_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#Wed Jul 01 02:12:49 PDT 2020 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 0 additions & 110 deletions
110
src/main/java/top/theillusivec4/caelus/api/CaelusAPI.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (C) 2019 C4 | ||
* | ||
* This file is part of Caelus, a mod made for Minecraft. | ||
* | ||
* Caelus is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Caelus is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with Caelus. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package top.theillusivec4.caelus.api; | ||
|
||
import java.util.UUID; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.ai.attributes.Attribute; | ||
import net.minecraft.entity.ai.attributes.AttributeModifier; | ||
import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance; | ||
import net.minecraft.entity.ai.attributes.RangedAttribute; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.inventory.EquipmentSlotType; | ||
import net.minecraft.item.ElytraItem; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
import net.minecraftforge.fml.RegistryObject; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
|
||
public class CaelusApi { | ||
|
||
public static final String MODID = "caelus"; | ||
public static final DeferredRegister<Attribute> ATTRIBUTES = DeferredRegister | ||
.create(Attribute.class, MODID); | ||
|
||
/** | ||
* The elytra flight attribute, will provide elytra flight if the value is 1.0 or above. No flight | ||
* otherwise. | ||
*/ | ||
public static final RegistryObject<Attribute> ELYTRA_FLIGHT = ATTRIBUTES.register("elytra_flight", | ||
() -> new RangedAttribute("caelus.elytraFlight", 0.0d, 0.0d, 1.0d).func_233753_a_(true)); | ||
|
||
/** | ||
* The attribute modifier used for the vanilla elytra item. | ||
*/ | ||
public static final AttributeModifier ELYTRA_MODIFIER = new AttributeModifier( | ||
UUID.fromString("5b6c3728-9c24-42ae-83ac-70d61d8b8199"), "Elytra modifier", 1.0f, | ||
AttributeModifier.Operation.ADDITION); | ||
|
||
/** | ||
* Checks whether or not an entity is able to elytra fly. Checks against the elytra flight | ||
* attribute if the entity is a {@link PlayerEntity}. Otherwise checks against the ItemStack in | ||
* the chest slot to see if it's a vanilla elytra item. | ||
* | ||
* @param livingEntity The entity to check for elytra flight capabilities | ||
* @return True if the entity can elytra fly, false otherwise. | ||
*/ | ||
public static boolean canElytraFly(LivingEntity livingEntity) { | ||
|
||
if (!(livingEntity instanceof PlayerEntity)) { | ||
ItemStack stack = livingEntity.getItemStackFromSlot(EquipmentSlotType.CHEST); | ||
return stack.getItem() == Items.ELYTRA && ElytraItem.isUsable(stack); | ||
} | ||
ModifiableAttributeInstance attribute = livingEntity.getAttribute(ELYTRA_FLIGHT.get()); | ||
return attribute != null && attribute.getValue() >= 1.0d; | ||
} | ||
} |
Oops, something went wrong.