Jump to content

Gerolmed

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Location
    player.getLocation()

Gerolmed's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Ok... didn't see that I'll try that out as as possible
  2. Didn't see that. But actually I need more rotations than a vanilla tree. I'll look into that another time..
  3. I have a block which can be placed to face different directions, but as soon as you relog all of them reset to the direction North... public class BlockMagicWood extends BasicBlock { public static PropertyDirection FACING = PropertyDirection.create("facing"); public BlockMagicWood() { super(Material.WOOD, Reference.WandustrieBlocks.MAGICWOOD.getUnlocalizedName(), Reference.WandustrieBlocks.MAGICWOOD.getRegistryName()); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP)); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {FACING}); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, EnumFacing.getDirectionFromEntityLiving(pos, placer))); super.onBlockPlacedBy(worldIn, pos, state, placer, stack); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(FACING).getIndex(); } @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(FACING, EnumFacing.getFront(meta)); } }
  4. Already thought of increasing the length. I might do that at a later time, but still the recipes arent loading although they are at the right Position
  5. Im trying to create a mod item only recipe but somehow it isnt detected by minecraft. I looked through all logs i could find, but no sign of it trying to register my recipe filedirectory: http://prntscr.com/hxocq8 ingotblock.json and logs:
  6. I was kind of following this tutorial: https://www.youtube.com/watch?v=NNclUS5edcY&t=1230s I have a custom item saved inside my TileEntity but it only shows up on world join not when changing the Item. Here is the Code: The update get and set have the same Code as read and write so it should be working. This is what is not working: @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { NBTTagCompound tag = pkt.getNbtCompound(); readUpdateTag(tag); this.readFromNBT(tag); } @Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound tag = new NBTTagCompound(); this.writeUpdateTag(tag); return new SPacketUpdateTileEntity(pos, getBlockMetadata(), tag); } @Override public NBTTagCompound getUpdateTag() { NBTTagCompound tag = super.getUpdateTag(); writeUpdateTag(tag); return tag; } public void writeUpdateTag(NBTTagCompound tag) { tag.setBoolean("infusing", infusing); tag.setInteger("infusiontimer", infusionTimer); NBTTagCompound compoundItem = new NBTTagCompound(); compoundItem = item.serializeNBT(); tag.setTag("item", compoundItem); } public void readUpdateTag(NBTTagCompound tag) { infusing = tag.getBoolean("infusing"); infusionTimer = tag.getInteger("infusiontimer"); NBTTagCompound compoundItem = tag.getCompoundTag("item"); item = new ItemStack(compoundItem); } . First = TileEntity. Second = renderer package net.mysticsouls.wandustrie.tileentity; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TileEntityManaInfuser extends TileEntity { public ItemStack item; boolean infusing; int infusionTimer; public void toggleItem(ItemStack item) { if(world.isRemote) return; ItemStack stack = removeItem(); if(stack != null) { world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY() + 1, pos.getZ(), stack)); } ItemStack newItem = item.copy(); newItem.setCount(1); setItem(newItem); resetInfuse(); markDirty(); IBlockState state = world.getBlockState(pos); world.notifyBlockUpdate(pos, state, state, 3); } ItemStack removeItem() { ItemStack stack = this.item; this.item = null; return stack; } void setItem(ItemStack item) { this.item = item; } void resetInfuse() { infusing = false; infusionTimer = 0; } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); this.writeUpdateTag(compound); return compound; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.readUpdateTag(compound); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { NBTTagCompound tag = pkt.getNbtCompound(); readUpdateTag(tag); this.readFromNBT(tag); } @Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound tag = new NBTTagCompound(); this.writeUpdateTag(tag); return new SPacketUpdateTileEntity(pos, getBlockMetadata(), tag); } @Override public NBTTagCompound getUpdateTag() { NBTTagCompound tag = super.getUpdateTag(); writeUpdateTag(tag); return tag; } public void writeUpdateTag(NBTTagCompound tag) { tag.setBoolean("infusing", infusing); tag.setInteger("infusiontimer", infusionTimer); NBTTagCompound compoundItem = new NBTTagCompound(); compoundItem = item.serializeNBT(); tag.setTag("item", compoundItem); } public void readUpdateTag(NBTTagCompound tag) { infusing = tag.getBoolean("infusing"); infusionTimer = tag.getInteger("infusiontimer"); NBTTagCompound compoundItem = tag.getCompoundTag("item"); item = new ItemStack(compoundItem); } } package net.mysticsouls.wandustrie.tileentity.render; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.mysticsouls.wandustrie.init.ModItems; import net.mysticsouls.wandustrie.tileentity.TileEntityManaInfuser; public class RendererManaInfuser extends TileEntitySpecialRenderer<TileEntityManaInfuser>{ private EntityItem ITEM = new EntityItem(Minecraft.getMinecraft().world, 0, 0, 0, new ItemStack(ModItems.magicOreIngot)); @Override public void renderTileEntityAt(TileEntityManaInfuser te, double x, double y, double z, float partialTicks, int destroyStage) { super.renderTileEntityAt(te, x, y, z, partialTicks, destroyStage); GlStateManager.pushMatrix(); { if(te.item != null) { ITEM = new EntityItem(Minecraft.getMinecraft().world, 0, 0, 0, te.item); ITEM.hoverStart = 0F; GlStateManager.translate(x, y, z); GlStateManager.translate(0.5, 0, 0.5); GlStateManager.rotate(45F, 0, 1, 0); Minecraft.getMinecraft().getRenderManager().doRenderEntity(ITEM, 0, 0, 0, 0F, 0F, false); } } GlStateManager.popMatrix(); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.