-
Posts
176 -
Joined
Everything posted by Silly511
-
[1.10.2] Getting the main entity from a entity part
Silly511 replied to Silly511's topic in Modder Support
I'm making a sword that cuts though any protections, including the attack event being canceled. To do this I'm directly modifying the entity's health using setHealth, which is why I can't use attackEntityFrom. -
I have a item that does something when you left-click a entity with it. However when you left click the ender dragon the method returns a instance of EntityDragonPart instead of EntityEnderDragon. I know I can get the dragon entity from the entityDragonObj field in EntityDragonPart, but how can I get the main entity from any multipart entities, including modded ones?
-
Don't use BlockRendererDispatcher. I think the method you want is Minecraft#getRenderItem().renderModel(ItemStack item, ItemCameraTransforms.TransformType type) or something like that. Pass ItemCameraTransforms.TransformType.NONE for the type and new ItemStack(Item.getItemForBlock(the block you want)) for the item stack.
-
Thanks that worked. I really wish I didn't have to have 3 events though.
-
I tried that but it doesn't work for the end. Traveling from the end to the overworld counts as respawning not traveling dimensions.
-
I am having some trouble syncing my WorldSavedData between the server and client. I have two packets: One that updates a single entry(this one works perfectly fine), and one that updates all the entries(For when the player logs in or changes dimension). However I am at a loss on what event to send my second packet. I tried PlayerLoggedInEvent but that only works for when the player logs in not when they change dimensions. I tried EntityJoinedWorldEvent but thats fired too early so Minecraft#theWorld is still null. What should I use thats fired when you log in or changed dimension? Heres my packet class: public class UpdateAuraChunksPacket implements IMessage { private NBTTagCompound tag; public UpdateAuraChunksPacket() {} public UpdateAuraChunksPacket(AuraChunkManager a) { this.tag = a.serializeNBT(); } @Override public void fromBytes(ByteBuf buf) { tag = ByteBufUtils.readTag(buf); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, tag); } public static class Handler implements IMessageHandler<UpdateAuraChunksPacket, IMessage> { @Override public IMessage onMessage(UpdateAuraChunksPacket message, MessageContext ctx) { AuraChunkManager.get(Minecraft.getMinecraft().theWorld).deserializeNBT(message.tag); AuraChunkManager.get(Minecraft.getMinecraft().theWorld).markDirty(); return null; } } }
-
You can't override classes. See if theres an event that you can use to do what you want.
-
[1.10.2][Solved] Getting errors when in minecraft forge's code
Silly511 replied to Silly511's topic in Modder Support
Thanks, that fixed it. I had my system JRE selected instead of the one that I had installed. -
[1.10.2][Solved] Getting errors when in minecraft forge's code
Silly511 replied to Silly511's topic in Modder Support
Mac OSX 10.10.1 and Eclipse -
I have forked and cloned github.com/minecraftforge because I wanted to submit a pull request for a new event, however I am getting 10 errors all of then relating to the Vector4f class. Is this a bug? One of the errors is on line 580 of OBJModel and says: "The method setW(float) is undefined for the type Vector4f".
-
Pressing the inventory key closes my container!
Silly511 replied to Rexozz's topic in Modder Support
It's supposed to do that. Why do you not want it to? -
[Solved] [1.10.2] Items in GUI not movable
Silly511 replied to abused_master's topic in Modder Support
Change if (world.isRemote) to if (!world.isRemote) in your block class. -
[1.10.2] Question about syncing tile entity data
Silly511 replied to Silly511's topic in Modder Support
I tried that but it doesn't work. Heres my code: public class TileCrystalFurnace extends TileEntity implements ITickable { private static ArrayList<Block> hotBlocks = new ArrayList(); static { hotBlocks.add(Blocks.LAVA); hotBlocks.add(Blocks.FLOWING_LAVA); hotBlocks.add(Block.getBlockFromName("magma")); } private ItemStackHandler inventory = new ItemStackHandler(2) { @Override protected void onContentsChanged(int slot) { TileCrystalFurnace.this.markDirty(); } @Override protected int getStackLimit(int slot, ItemStack stack) { if (slot == 0) { if (stack.getItem() == Items.DIAMOND) return super.getStackLimit(slot, stack); } else if (slot == 1) { if (stack.getItem() == Item.getItemFromBlock(Blocks.GLASS)) return super.getStackLimit(slot, stack); } return 0; } }; private FluidTank crystalTank = new FluidTank(Fluid.BUCKET_VOLUME * 2) { @Override protected void onContentsChanged() { TileCrystalFurnace.this.markDirty(); } }; public boolean isHeated; public boolean isMelting; public int meltTime = 0; public TileCrystalFurnace() { crystalTank.setCanFill(false); } @Override public void update() { isHeated = worldObj.getBlockState(pos.add(0, -1, 0)) != null && hotBlocks.contains(worldObj.getBlockState(pos.add(0, -1, 0)).getBlock()); if (worldObj.isRemote) return; if (isHeated && !isMelting && inventory.extractItem(0, 1, true) != null && inventory.extractItem(1, 3, true) != null && inventory.extractItem(1, 3, true).stackSize == 3 && crystalTank.fillInternal(new FluidStack(EnchantedAura.liquidCrystal, 500), false) == 500) { inventory.extractItem(0, 1, false); inventory.extractItem(1, 3, false); isMelting = true; meltTime = 400; this.markDirty(); } if (isMelting && meltTime == 0) { isMelting = false; crystalTank.fillInternal(new FluidStack(EnchantedAura.liquidCrystal, 500), true); this.markDirty(); } if (isMelting && isHeated) { meltTime--; this.markDirty(); } } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); inventory.deserializeNBT(compound.getCompoundTag("inventory")); crystalTank.readFromNBT(compound.getCompoundTag("crystalTank")); meltTime = compound.getInteger("meltTime"); isMelting = compound.getBoolean("isMelting"); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound.setTag("inventory", inventory.serializeNBT()); compound.setTag("crystalTank", crystalTank.writeToNBT(new NBTTagCompound())); compound.setInteger("meltTime", meltTime); compound.setBoolean("isMelting", isMelting); return super.writeToNBT(compound); } @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) return true; return super.hasCapability(capability, facing); } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T) inventory; else if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) return (T) crystalTank; return super.getCapability(capability, facing); } @Override public final NBTTagCompound getUpdateTag() { return this.writeToNBT(new NBTTagCompound()); } @Override public SPacketUpdateTileEntity getUpdatePacket() { return new SPacketUpdateTileEntity(this.getPos(), 1, this.getUpdateTag()); } } My GUI never shows the progress bar moving, or liquid entering the tank. It does show the items disappearing however thats probably because the container syncs items. -
[1.10.2] Question about syncing tile entity data
Silly511 replied to Silly511's topic in Modder Support
Ok, how would I go about that? I played around a bit with tile entities in 1.7.10 but the syncing system has changed so I'm completely lost. -
[1.10.2] Question about syncing tile entity data
Silly511 replied to Silly511's topic in Modder Support
Yes. -
Which is better: Changing my tile entity data on both the server and client but never sync it, or changing it only on the server and sync it to the client? And if the answer is the second one, how would I do it?
-
[Solved][1.10.2] Can't get blockstates file to work
Silly511 replied to Silly511's topic in Modder Support
Never mind got it to work. Heres the new blockstates file: { "forge_marker": 1, "defaults": { "model": "orientable", "textures": { "top": "EnchantedAura:blocks/crystal_furnace_top", "side": "EnchantedAura:blocks/crystal_furnace_side", "front": "EnchantedAura:blocks/crystal_furnace_front" } }, "variants": { "facing": { "north": {}, "south": { "transform": { "rotation": { "y": 180 }}}, "west": { "transform": { "rotation": { "y": 270 }}}, "east": { "transform": { "rotation": { "y": 90 }}} }, "inventory": [{}] } } -
Yeah I spotted those. Heres my new block file: public class CrystalFurnace extends Block { public static final PropertyDirection FACING = BlockHorizontal.FACING; public CrystalFurnace() { super(Material.ROCK, MapColor.RED); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.setCreativeTab(EnchantedAura.mainTab); this.setSoundType(SoundType.STONE); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, FACING); } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(FACING).getHorizontalIndex(); } }
-
Why does this blockstates file not work? I know the facing property exists because it shows up on the debug screen. { "forge_marker": 1, "defaults": { "model": "block/orientable", "textures": { "top": "EnchantedAura:blocks/crystal_furnace_top", "side": "EnchantedAura:blocks/crystal_furnace_side", "front": "EnchantedAura:blocks/crystal_furnace_front" } }, "variants": { "facing": { "north": {}, "south": { "transform": { "y": 180 } }, "west": { "transform": { "y": 270 } }, "east": { "transform": { "y": 90 } } }, "inventory": [{}] } }
-
Thanks, this is my first time playing with blockstates.
-
I have a block with a facing property. However for some reason I can't set it's default state. Heres my block class: public class CrystalFurnace extends Block { public static final PropertyDirection FACING = BlockHorizontal.FACING; public CrystalFurnace() { super(Material.ROCK, MapColor.RED); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.setCreativeTab(EnchantedAura.mainTab); this.setSoundType(SoundType.STONE); } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getStateFromMeta(meta).withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } @Override public IBlockState getStateFromMeta(int meta) { if (meta >= 2 && meta <= 5) return getDefaultState(); return getDefaultState().withProperty(FACING, EnumFacing.getFront(meta)); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(FACING).getIndex(); } } But every time I run the game it crashes with this crash: How can I fix this?
-
Try removing the getCollisionBoundingBox method, and only have addCollisionBoxToList.
-
I am trying to render something on the player using RenderPlayerEvent, but I don't know what stage to use. In 1.7.10 I used RenderPlayerEvent.Specials.Pre, but now RenderPlayerEvent.Specials is deprecated. I tried to use RenderPlayerEvent.Pre but that rendered it all weird. What do I do? Heres my code: @SubscribeEvent public void onRenderPlayer(RenderPlayerEvent.Specials.Pre event) { Minecraft mc = Minecraft.getMinecraft(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); GlStateManager.pushMatrix(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend(); mc.renderEngine.bindTexture(wingsTexture); GlStateManager.disableLighting(); Minecraft.getMinecraft().entityRenderer.disableLightmap(); GlStateManager.depthMask(true); ColorHelper.setRainbowColor(); GlStateManager.translate(0, 0.5, 0); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos(-2, -0.666666, 0.2).tex(0, 0).endVertex(); vertexbuffer.pos(-2, 0.666666, 0.2).tex(0, 1).endVertex(); vertexbuffer.pos(2, 0.666666, 0.2).tex(1, 1).endVertex(); vertexbuffer.pos(2, -0.666666, 0.2).tex(1, 0).endVertex(); tessellator.draw(); Minecraft.getMinecraft().entityRenderer.enableLightmap(); GlStateManager.popMatrix(); }
-
Thank you I figured it out. Heres the blockstate file I used: { "forge_marker": 1, "defaults": { "model": "OBJ Model Here", "textures": { Textures Here }, "transform": { Transformations Here } }, "variants": { "inventory": [{}] } }
-
That works, but I want to be able to rotate, scale, and translate the model.