-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
bb654bd
commit 17f7be5
Showing
16 changed files
with
1,442 additions
and
0 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
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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/github/elenterius/biomancy/client/render/item/armor/package-info.java
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,7 @@ | ||
@ParametersAreNonnullByDefault | ||
@MethodsReturnNonnullByDefault | ||
package com.github.elenterius.biomancy.client.render.item.armor; | ||
|
||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/github/elenterius/biomancy/client/render/item/shield/ThornShieldModel.java
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,20 @@ | ||
package com.github.elenterius.biomancy.client.render.item.shield; | ||
|
||
import com.github.elenterius.biomancy.BiomancyMod; | ||
import com.github.elenterius.biomancy.item.shield.ThornShieldItem; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraft.resources.ResourceLocation; | ||
import software.bernie.geckolib.model.DefaultedItemGeoModel; | ||
|
||
public class ThornShieldModel extends DefaultedItemGeoModel<ThornShieldItem> { | ||
|
||
public ThornShieldModel() { | ||
super(BiomancyMod.createRL("shield/thorn_shield")); | ||
} | ||
|
||
@Override | ||
public RenderType getRenderType(ThornShieldItem animatable, ResourceLocation texture) { | ||
return RenderType.entityCutout(texture); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...in/java/com/github/elenterius/biomancy/client/render/item/shield/ThornShieldRenderer.java
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,12 @@ | ||
package com.github.elenterius.biomancy.client.render.item.shield; | ||
|
||
import com.github.elenterius.biomancy.item.shield.ThornShieldItem; | ||
import software.bernie.geckolib.renderer.GeoItemRenderer; | ||
|
||
public class ThornShieldRenderer extends GeoItemRenderer<ThornShieldItem> { | ||
|
||
public ThornShieldRenderer() { | ||
super(new ThornShieldModel()); | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/github/elenterius/biomancy/client/render/item/shield/package-info.java
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,7 @@ | ||
@ParametersAreNonnullByDefault | ||
@MethodsReturnNonnullByDefault | ||
package com.github.elenterius.biomancy.client.render.item.shield; | ||
|
||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; |
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
85 changes: 85 additions & 0 deletions
85
src/main/java/com/github/elenterius/biomancy/item/shield/ThornShieldItem.java
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,85 @@ | ||
package com.github.elenterius.biomancy.item.shield; | ||
|
||
import com.github.elenterius.biomancy.client.render.item.shield.ThornShieldRenderer; | ||
import com.github.elenterius.biomancy.item.SimpleItem; | ||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResultHolder; | ||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ArmorItem; | ||
import net.minecraft.world.item.Equipable; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.UseAnim; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.DispenserBlock; | ||
import net.minecraftforge.client.extensions.common.IClientItemExtensions; | ||
import net.minecraftforge.common.ToolAction; | ||
import net.minecraftforge.common.ToolActions; | ||
import software.bernie.geckolib.animatable.GeoItem; | ||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; | ||
import software.bernie.geckolib.core.animation.AnimatableManager; | ||
import software.bernie.geckolib.util.GeckoLibUtil; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public class ThornShieldItem extends SimpleItem implements Equipable, GeoItem { | ||
|
||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); | ||
|
||
public ThornShieldItem(Properties properties) { | ||
super(properties); | ||
DispenserBlock.registerBehavior(this, ArmorItem.DISPENSE_ITEM_BEHAVIOR); | ||
} | ||
|
||
@Override | ||
public EquipmentSlot getEquipmentSlot() { | ||
return EquipmentSlot.OFFHAND; | ||
} | ||
|
||
@Override | ||
public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { | ||
return ToolActions.DEFAULT_SHIELD_ACTIONS.contains(toolAction); | ||
} | ||
|
||
@Override | ||
public UseAnim getUseAnimation(ItemStack stack) { | ||
return UseAnim.BLOCK; | ||
} | ||
|
||
@Override | ||
public int getUseDuration(ItemStack stack) { | ||
return 72000; | ||
} | ||
|
||
@Override | ||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) { | ||
ItemStack stack = player.getItemInHand(hand); | ||
player.startUsingItem(hand); | ||
return InteractionResultHolder.consume(stack); | ||
} | ||
|
||
@Override | ||
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { | ||
//nothing atm | ||
} | ||
|
||
@Override | ||
public AnimatableInstanceCache getAnimatableInstanceCache() { | ||
return cache; | ||
} | ||
|
||
@Override | ||
public void initializeClient(Consumer<IClientItemExtensions> consumer) { | ||
super.initializeClient(consumer); | ||
consumer.accept(new IClientItemExtensions() { | ||
private final ThornShieldRenderer renderer = new ThornShieldRenderer(); | ||
|
||
@Override | ||
public BlockEntityWithoutLevelRenderer getCustomRenderer() { | ||
return renderer; | ||
} | ||
}); | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/github/elenterius/biomancy/item/shield/package-info.java
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,7 @@ | ||
@ParametersAreNonnullByDefault | ||
@MethodsReturnNonnullByDefault | ||
package com.github.elenterius.biomancy.item.shield; | ||
|
||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; |
6 changes: 6 additions & 0 deletions
6
src/main/resources/assets/biomancy/animations/item/shield/thorn_shield.animation.json
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,6 @@ | ||
{ | ||
"format_version": "1.8.0", | ||
"animations": { | ||
}, | ||
"geckolib_format_version": 2 | ||
} |
Oops, something went wrong.