mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
fix worms moonwalking
This commit is contained in:
parent
c3851df8ff
commit
6ddc276774
6 changed files with 39 additions and 2 deletions
|
@ -32,6 +32,7 @@ public class RenderWorm extends Render<EntityWorm>{
|
||||||
return new RenderWorm(manager);
|
return new RenderWorm(manager);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final ItemStack STACK = new ItemStack(InitItems.itemWorm);
|
private static final ItemStack STACK = new ItemStack(InitItems.itemWorm);
|
||||||
|
|
||||||
protected RenderWorm(RenderManager renderManager){
|
protected RenderWorm(RenderManager renderManager){
|
||||||
|
@ -48,9 +49,12 @@ public class RenderWorm extends Render<EntityWorm>{
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate(x, y+0.7F, z);
|
GlStateManager.translate(x, y+0.7F, z);
|
||||||
double boop = Minecraft.getSystemTime()/70D;
|
double boop = Minecraft.getSystemTime()/70D;
|
||||||
GlStateManager.rotate((float)((boop%360)), 0, 1, 0);
|
GlStateManager.rotate(-(float)((boop%360)), 0, 1, 0);
|
||||||
GlStateManager.translate(0, 0, 0.4);
|
GlStateManager.translate(0, 0, 0.4);
|
||||||
|
|
||||||
|
STACK.setStackDisplayName(entity.getCustomNameTag());
|
||||||
AssetUtil.renderItemInWorld(STACK);
|
AssetUtil.renderItemInWorld(STACK);
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,22 +13,28 @@ package de.ellpeck.actuallyadditions.mod.items;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
|
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.BlockGrass;
|
import net.minecraft.block.BlockGrass;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
|
import net.minecraft.item.IItemPropertyGetter;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -38,6 +44,14 @@ public class ItemWorm extends ItemBase{
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
|
this.addPropertyOverride(new ResourceLocation(ModUtil.MOD_ID, "snail"), new IItemPropertyGetter(){
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public float apply(ItemStack stack, World world, EntityLivingBase entity){
|
||||||
|
return "snail mail".equalsIgnoreCase(stack.getDisplayName()) ? 1F : 0F;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,6 +64,7 @@ public class ItemWorm extends ItemBase{
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
EntityWorm worm = new EntityWorm(world);
|
EntityWorm worm = new EntityWorm(world);
|
||||||
worm.setPosition(pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5);
|
worm.setPosition(pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5);
|
||||||
|
worm.setCustomNameTag(stack.getDisplayName());
|
||||||
world.spawnEntity(worm);
|
world.spawnEntity(worm);
|
||||||
|
|
||||||
if(!player.capabilities.isCreativeMode){
|
if(!player.capabilities.isCreativeMode){
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "actuallyadditions:item/standard_item",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "actuallyadditions:items/item_snail"
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,5 +2,11 @@
|
||||||
"parent": "actuallyadditions:item/standard_item",
|
"parent": "actuallyadditions:item/standard_item",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "actuallyadditions:items/item_worm"
|
"layer0": "actuallyadditions:items/item_worm"
|
||||||
}
|
},
|
||||||
|
"overrides": [{
|
||||||
|
"predicate": {
|
||||||
|
"actuallyadditions:snail": 1
|
||||||
|
},
|
||||||
|
"model": "actuallyadditions:item/item_snail"
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"frametime": 3
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue