Jump to content

JimiIT92

Members
  • Posts

    867
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JimiIT92

  1. If the fog isn't necessarly you can try removing all the fog related methods in the World Provider Also could you tell me how you registered the dimension?
  2. If the fog isn't necessarly you can try removing all the fog related methods in the World Provider Also could you tell me how you registered the dimension?
  3. Thanks for both answer and the list of renamed things
  4. Thanks for both answer and the list of renamed things
  5. Doing a custom portal to a custom dimension, in 1.8 i was doing this thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 2, new TeleporterCorrupted(thePlayer.mcServer.worldServerForDimension(2))); But now in 1.9 i can't find how to do it, since the getConfigurationManager method is no longer available So how can i teleport an entity to another dimension in 1.9? I've tried usind entity.changeDimension(-1) to teleport entities in the Nether, but the game will freeze
  6. Doing a custom portal to a custom dimension, in 1.8 i was doing this thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 2, new TeleporterCorrupted(thePlayer.mcServer.worldServerForDimension(2))); But now in 1.9 i can't find how to do it, since the getConfigurationManager method is no longer available So how can i teleport an entity to another dimension in 1.9? I've tried usind entity.changeDimension(-1) to teleport entities in the Nether, but the game will freeze
  7. Thanks, adding that class made the block green
  8. It looks like something has changed to make a block that change color based on biome (like grass does). Infact i was trying to make a grass slab, by using this class package com.mwvanilla.blocks; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.biome.BiomeColorHelper; public abstract class BlockGrassSlab extends BlockVanillaSlab implements IBlockColor { public BlockGrassSlab() { super(Blocks.grass); } @Override public int colorMultiplier(IBlockState state, IBlockAccess access, BlockPos pos, int tintIndex) { return BiomeColorHelper.getGrassColorAtPos(access, pos); } } But in game the slab looks like this So it seems the colorMultiplier function is never called. The Json file for the slab (the lower one) is this { "parent": "block/block", "textures": { "bottom": "blocks/dirt", "top": "blocks/grass_top", "side": "blocks/grass_side", "overlay" : "blocks/grass_side_overlay", "particle": "blocks/dirt" }, "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 8, 16 ], "faces": { "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top" , "tintindex": 0}, "north": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "north" }, "south": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "south" }, "west": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "west" }, "east": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "east" } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 8, 16 ], "faces": { "north": { "uv": [ 0, 8, 16, 16 ], "texture": "#overlay", "cullface": "north" , "tintindex": 0}, "south": { "uv": [ 0, 8, 16, 16 ], "texture": "#overlay", "cullface": "south", "tintindex": 0 }, "west": { "uv": [ 0, 8, 16, 16 ], "texture": "#overlay", "cullface": "west" , "tintindex": 0}, "east": { "uv": [ 0, 8, 16, 16 ], "texture": "#overlay", "cullface": "east" , "tintindex": 0} } } ] } And this is the super class BlockVanillaSlab package com.mwvanilla.blocks; import java.util.List; import java.util.Random; import com.mineworld.blocks.ores.BlockOreSlab; import com.mwvanilla.core.MWVanillaSlabs; import com.mwvanilla.core.MWVanillaTabs; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockSlab; import net.minecraft.block.BlockSlab.EnumBlockHalf; import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.resources.FoliageColorReloadListener; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Enchantments; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeColorHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public abstract class BlockVanillaSlab extends BlockSlab { public static final PropertyEnum<BlockVanillaSlab.Variant> VARIANT = PropertyEnum.<BlockVanillaSlab.Variant>create("variant", BlockVanillaSlab.Variant.class); private Block block; public BlockVanillaSlab(Block block) { super(block.getDefaultState().getMaterial()); this.block = block; IBlockState iblockstate = this.blockState.getBaseState(); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); this.setCreativeTab(MWVanillaTabs.tabVanillaSlabs); } this.setDefaultState(iblockstate.withProperty(VARIANT, BlockVanillaSlab.Variant.DEFAULT)); this.setHardness(block.getBlockHardness(block.getDefaultState(), null, null)); this.setResistance(block.getExplosionResistance(null)); this.setStepSound(this.block.getStepSound()); if(this.block.equals(Blocks.glowstone)) this.setLightLevel(0.75F); if(this.block.equals(Blocks.sea_lantern)) this.setLightLevel(1.0F); this.useNeighborBrightness = !this.isDouble(); if(this.block.equals(Blocks.ice) || this.block.equals(Blocks.packed_ice)) this.slipperiness = 0.98F; this.setTickRandomly(this.block.equals(Blocks.ice) || this.block.equals(Blocks.mycelium)); } @Override public boolean isOpaqueCube(IBlockState state) { return state.getMaterial().equals(Material.glass) || state.getMaterial().equals(Material.ice) ? false : super.isOpaqueCube(state); } @Override public EnumPushReaction getMobilityFlag(IBlockState state) { return this.block.equals(Blocks.obsidian) ? EnumPushReaction.BLOCK : EnumPushReaction.NORMAL; } @Override public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { if(this.block.getDefaultState().getMaterial().equals(Material.glass) || this.block.getDefaultState().getMaterial().equals(Material.ice)) return Blocks.glass.doesSideBlockRendering(state, world, pos, face); else return super.doesSideBlockRendering(state, world, pos, face); } @Override public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { if(this.block.getDefaultState().getMaterial().equals(Material.glass) || this.block.getDefaultState().getMaterial().equals(Material.ice)) { IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side)); Block block = iblockstate.getBlock(); if (blockState != iblockstate) { return true; } if (block == this) { return false; } return block == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side); } return super.shouldSideBeRendered(blockState, blockAccess, pos, side); } @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return this.block.equals(Blocks.glass) || this.block.equals(Blocks.grass) ? BlockRenderLayer.CUTOUT : this.block.equals(Blocks.stained_glass) || this.block.equals(Blocks.ice) ? BlockRenderLayer.TRANSLUCENT : BlockRenderLayer.SOLID; } public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack) { if(this.block.equals(Blocks.ice)) { player.addStat(StatList.func_188055_a(this)); player.addExhaustion(0.025F); if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, stack) > 0) { java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>(); ItemStack itemstack = this.createStackedBlock(state); if (itemstack != null) { items.add(itemstack); } net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player); for (ItemStack is : items) spawnAsEntity(worldIn, pos, is); } else { if (worldIn.provider.doesWaterVaporize()) { worldIn.setBlockToAir(pos); return; } int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, stack); harvesters.set(player); this.dropBlockAsItem(worldIn, pos, state, i); harvesters.set(null); Material material = worldIn.getBlockState(pos.down()).getMaterial(); if (material.blocksMovement() || material.isLiquid()) { worldIn.setBlockState(pos, Blocks.flowing_water.getDefaultState()); } } } } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (this.block.equals(Blocks.ice) && worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11 - this.getDefaultState().getLightOpacity()) { this.func_185679_b(worldIn, pos); } } private void func_185679_b(World p_185679_1_, BlockPos p_185679_2_) { if (p_185679_1_.provider.doesWaterVaporize()) { p_185679_1_.setBlockToAir(p_185679_2_); } else { this.dropBlockAsItem(p_185679_1_, p_185679_2_, p_185679_1_.getBlockState(p_185679_2_), 0); p_185679_1_.setBlockState(p_185679_2_, Blocks.water.getDefaultState()); p_185679_1_.notifyBlockOfStateChange(p_185679_2_, Blocks.water); } } protected boolean canSilkHarvest() { return (this.block.getDefaultState().getMaterial().equals(Material.glass) || this.block.getDefaultState().getMaterial().equals(Material.ice)) && !this.isDouble() ? true : super.canSilkHarvest(); } @Override public boolean isFireSource(World world, BlockPos pos, EnumFacing face) { if(this.block.equals(Blocks.netherrack)) { super.isFireSource(world, pos, face); if(face == EnumFacing.UP) { return true; } return false; } return false; } /** * Called When an Entity Collided with the Block */ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if(this.block.equals(Blocks.soul_sand)) { entityIn.motionX *= 0.4D; entityIn.motionZ *= 0.4D; } } @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState worldIn, World pos, BlockPos state, Random rand) { if(this.block.equals(Blocks.mycelium)) { super.randomDisplayTick(worldIn, pos, state, rand); if (rand.nextInt(10) == 0) { pos.spawnParticle(EnumParticleTypes.TOWN_AURA, (double)((float)state.getX() + rand.nextFloat()), (double)((float)state.getY() + 1.1F), (double)((float)state.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D, new int[0]); } } } @Override public int quantityDropped(IBlockState state, int fortune, Random random) { return this.block.getDefaultState().getMaterial().equals(Material.glass) || this.block.getDefaultState().getMaterial().equals(Material.ice) || this.block.getDefaultState().getMaterial().equals(Material.packedIce) ? 0 : super.quantityDropped(state, fortune, random); } @Override public boolean canProvidePower(IBlockState state) { return this.block.equals(Blocks.redstone_block); } @Override public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return this.block.equals(Blocks.redstone_block) ? 15 : 0; } /** * Get the Item that this Block should drop when harvested. */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return this.block.getDefaultState().getMaterial().equals(Material.glass) ? null : Item.getItemFromBlock(this); } public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(Item.getItemFromBlock(this)); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockVanillaSlab.Variant.DEFAULT); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, (meta & == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { int i = 0; if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { i |= 8; } return i; } protected BlockStateContainer createBlockState() { return this.isDouble() ? new BlockStateContainer(this, new IProperty[] {VARIANT}): new BlockStateContainer(this, new IProperty[] {HALF, VARIANT}); } /** * Returns the slab block name with the type associated with it */ public String getUnlocalizedName(int meta) { return super.getUnlocalizedName(); } public IProperty<?> getVariantProperty() { return VARIANT; } public Comparable<?> getTypeForItem(ItemStack stack) { return BlockVanillaSlab.Variant.DEFAULT; } public static enum Variant implements IStringSerializable { DEFAULT; public String getName() { return "default"; } } } So how can i make this slab looks like grass?
  9. EDIT: the crash was cause by the doesSideBlockRendering, wich overriding properly as solved the problem. In case everyone want to look how this has been fixed, this is the complete class package com.mwvanilla.blocks; import java.util.List; import java.util.Random; import com.mineworld.blocks.ores.BlockOreSlab; import com.mwvanilla.core.MWVanillaSlabs; import com.mwvanilla.core.MWVanillaTabs; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.BlockSlab.EnumBlockHalf; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public abstract class BlockVanillaSlab extends BlockSlab { public static final PropertyEnum<BlockVanillaSlab.Variant> VARIANT = PropertyEnum.<BlockVanillaSlab.Variant>create("variant", BlockVanillaSlab.Variant.class); private Block block; public BlockVanillaSlab(Block block) { super(block.getDefaultState().getMaterial()); this.block = block; IBlockState iblockstate = this.blockState.getBaseState(); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); this.setCreativeTab(MWVanillaTabs.tabVanillaSlabs); } this.setDefaultState(iblockstate.withProperty(VARIANT, BlockVanillaSlab.Variant.DEFAULT)); this.setHardness(block.getBlockHardness(block.getDefaultState(), null, null)); this.setResistance(block.getExplosionResistance(null)); this.setStepSound(this.block.getStepSound()); if(this.block.equals(Blocks.glowstone)) this.setLightLevel(0.75F); if(this.block.equals(Blocks.sea_lantern)) this.setLightLevel(1.0F); this.useNeighborBrightness = !this.isDouble(); } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { if(this.block.getDefaultState().getMaterial().equals(Material.glass)) return Blocks.glass.doesSideBlockRendering(state, world, pos, face); else return super.doesSideBlockRendering(state, world, pos, face); } @Override public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { if(this.block.getDefaultState().getMaterial().equals(Material.glass)) { IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side)); Block block = iblockstate.getBlock(); if (blockState != iblockstate) { return true; } if (block == this) { return false; } return block == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side); } return super.shouldSideBeRendered(blockState, blockAccess, pos, side); } @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return this.block.getDefaultState().getMaterial().equals(Material.glass) ? BlockRenderLayer.CUTOUT : BlockRenderLayer.SOLID; } protected boolean canSilkHarvest() { return !this.isDouble(); } @Override public boolean canProvidePower(IBlockState state) { return this.block.equals(Blocks.redstone_block); } @Override public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return this.block.equals(Blocks.redstone_block) ? 15 : 0; } /** * Get the Item that this Block should drop when harvested. */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return this.block.getDefaultState().getMaterial().equals(Material.glass) ? null : Item.getItemFromBlock(this); } public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(Item.getItemFromBlock(this)); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockVanillaSlab.Variant.DEFAULT); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, (meta & == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { int i = 0; if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { i |= 8; } return i; } protected BlockStateContainer createBlockState() { return this.isDouble() ? new BlockStateContainer(this, new IProperty[] {VARIANT}): new BlockStateContainer(this, new IProperty[] {HALF, VARIANT}); } /** * Returns the slab block name with the type associated with it */ public String getUnlocalizedName(int meta) { return super.getUnlocalizedName(); } public IProperty<?> getVariantProperty() { return VARIANT; } public Comparable<?> getTypeForItem(ItemStack stack) { return BlockVanillaSlab.Variant.DEFAULT; } public static enum Variant implements IStringSerializable { DEFAULT; public String getName() { return "default"; } } } Thank you diesieben for the help
  10. I've already looked at that classes. Already added in the slab class the getBlockLayer function and the canSilkHarvest function. The only functions not added are the isFullCube, the isOpaque and the shouldSideBeRendered. Adding the isFullCube didn't change, overriding the shouldSideBeRendered to call the supermethod if the material isn't glass or running the same code of the BlockBreakable class if it is also didn't change. So i've added the last function, isOpaque, returning always false, but then the game crashes as i place a double slab (also the glitch persist). The class is now looking like this package com.mwvanilla.blocks; import java.util.List; import java.util.Random; import com.mineworld.blocks.ores.BlockOreSlab; import com.mwvanilla.core.MWVanillaSlabs; import com.mwvanilla.core.MWVanillaTabs; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.BlockSlab.EnumBlockHalf; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public abstract class BlockVanillaSlab extends BlockSlab { public static final PropertyEnum<BlockVanillaSlab.Variant> VARIANT = PropertyEnum.<BlockVanillaSlab.Variant>create("variant", BlockVanillaSlab.Variant.class); private Block block; public BlockVanillaSlab(Block block) { super(block.getDefaultState().getMaterial()); this.block = block; IBlockState iblockstate = this.blockState.getBaseState(); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); this.setCreativeTab(MWVanillaTabs.tabVanillaSlabs); } this.setDefaultState(iblockstate.withProperty(VARIANT, BlockVanillaSlab.Variant.DEFAULT)); this.setHardness(block.getBlockHardness(block.getDefaultState(), null, null)); this.setResistance(block.getExplosionResistance(null)); this.setStepSound(this.block.getStepSound()); if(this.block.equals(Blocks.glowstone)) this.setLightLevel(0.75F); if(this.block.equals(Blocks.sea_lantern)) this.setLightLevel(1.0F); this.useNeighborBrightness = !this.isDouble(); } public boolean isFullCube(IBlockState state) { return false; } public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { if(this.block.getDefaultState().getMaterial().equals(Material.glass)) { IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side)); Block block = iblockstate.getBlock(); if (blockState != iblockstate) { return true; } if (block == this) { return false; } return block == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side); } return this.isDouble() ? true : super.shouldSideBeRendered(blockState, blockAccess, pos, side); } @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return this.block.getDefaultState().getMaterial().equals(Material.glass) ? BlockRenderLayer.CUTOUT : BlockRenderLayer.SOLID; } protected boolean canSilkHarvest() { return !this.isDouble(); } @Override public boolean canProvidePower(IBlockState state) { return this.block.equals(Blocks.redstone_block); } @Override public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return this.block.equals(Blocks.redstone_block) ? 15 : 0; } /** * Get the Item that this Block should drop when harvested. */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return this.block.getDefaultState().getMaterial().equals(Material.glass) ? null : Item.getItemFromBlock(this); } public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(Item.getItemFromBlock(this)); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockVanillaSlab.Variant.DEFAULT); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, (meta & == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { int i = 0; if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { i |= 8; } return i; } protected BlockStateContainer createBlockState() { return this.isDouble() ? new BlockStateContainer(this, new IProperty[] {VARIANT}): new BlockStateContainer(this, new IProperty[] {HALF, VARIANT}); } /** * Returns the slab block name with the type associated with it */ public String getUnlocalizedName(int meta) { return super.getUnlocalizedName(); } public IProperty<?> getVariantProperty() { return VARIANT; } public Comparable<?> getTypeForItem(ItemStack stack) { return BlockVanillaSlab.Variant.DEFAULT; } public static enum Variant implements IStringSerializable { DEFAULT; public String getName() { return "default"; } } } And this is the crash i have java.lang.IllegalArgumentException: Cannot get property PropertyEnum{name=half, clazz=class net.minecraft.block.BlockSlab$EnumBlockHalf, values=[top, bottom]} as it does not exist in BlockStateContainer{block=mw:glass_double_slab, properties=[variant]} at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:192) at net.minecraft.block.BlockSlab.doesSideBlockRendering(BlockSlab.java:67) at net.minecraft.block.state.BlockStateContainer$StateImplementation.doesSideBlockRendering(BlockStateContainer.java:468) at net.minecraft.block.Block.shouldSideBeRendered(Block.java:516) at net.minecraft.block.state.BlockStateContainer$StateImplementation.shouldSideBeRendered(BlockStateContainer.java:408) at net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer.render(ForgeBlockModelRenderer.java:113) at net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer.renderModelSmooth(ForgeBlockModelRenderer.java:84) at net.minecraft.client.renderer.BlockModelRenderer.renderModel(BlockModelRenderer.java:45) at net.minecraft.client.renderer.BlockModelRenderer.renderModel(BlockModelRenderer.java:36) at net.minecraft.client.renderer.BlockRendererDispatcher.renderBlock(BlockRendererDispatcher.java:81) at net.minecraft.client.renderer.chunk.RenderChunk.rebuildChunk(RenderChunk.java:196) at net.minecraft.client.renderer.chunk.ChunkRenderWorker.processTask(ChunkRenderWorker.java:124) at net.minecraft.client.renderer.chunk.ChunkRenderDispatcher.updateChunkNow(ChunkRenderDispatcher.java:171) at net.minecraft.client.renderer.RenderGlobal.setupTerrain(RenderGlobal.java:975) at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1339) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1282) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1135) at net.minecraft.client.Minecraft.run(Minecraft.java:401) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) It says that it cannot set the half property to a double slab as it doesn't exixts, wich is correct but looking at the supermethod the doubleslab case is handled well
  11. I'm using this class to make some slabs. However one of this is a glass slab, and so it needs to be transparent. The texture it is, but when placed down it glitches the block below, but only the double or the bottom slab, doing this I've already tried adding the BlockGlass methods (isOpaque/isFullCube) but the glitch reamin This is the class i use package com.mwvanilla.blocks; import java.util.List; import java.util.Random; import com.mineworld.blocks.ores.BlockOreSlab; import com.mwvanilla.core.MWVanillaSlabs; import com.mwvanilla.core.MWVanillaTabs; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.BlockSlab.EnumBlockHalf; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public abstract class BlockVanillaSlab extends BlockSlab { public static final PropertyEnum<BlockVanillaSlab.Variant> VARIANT = PropertyEnum.<BlockVanillaSlab.Variant>create("variant", BlockVanillaSlab.Variant.class); private Block block; public BlockVanillaSlab(Block block) { super(block.getDefaultState().getMaterial()); this.block = block; IBlockState iblockstate = this.blockState.getBaseState(); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); this.setCreativeTab(MWVanillaTabs.tabVanillaSlabs); } this.setDefaultState(iblockstate.withProperty(VARIANT, BlockVanillaSlab.Variant.DEFAULT)); this.setHardness(block.getBlockHardness(block.getDefaultState(), null, null)); this.setResistance(block.getExplosionResistance(null)); this.setStepSound(this.block.getStepSound()); if(this.block.equals(Blocks.glowstone)) this.setLightLevel(0.75F); if(this.block.equals(Blocks.sea_lantern)) this.setLightLevel(1.0F); this.useNeighborBrightness = !this.isDouble(); } @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return this.block.getDefaultState().getMaterial().equals(Material.glass) ? BlockRenderLayer.CUTOUT : BlockRenderLayer.SOLID; } protected boolean canSilkHarvest() { return this.block.getDefaultState().getMaterial().equals(Material.glass); } @Override public boolean canProvidePower(IBlockState state) { return this.block.equals(Blocks.redstone_block); } @Override public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return this.block.equals(Blocks.redstone_block) ? 15 : 0; } /** * Get the Item that this Block should drop when harvested. */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return this.block.getDefaultState().getMaterial().equals(Material.glass) ? null : Item.getItemFromBlock(this); } public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(Item.getItemFromBlock(this)); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockVanillaSlab.Variant.DEFAULT); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, (meta & == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { int i = 0; if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { i |= 8; } return i; } protected BlockStateContainer createBlockState() { return this.isDouble() ? new BlockStateContainer(this, new IProperty[] {VARIANT}): new BlockStateContainer(this, new IProperty[] {HALF, VARIANT}); } /** * Returns the slab block name with the type associated with it */ public String getUnlocalizedName(int meta) { return super.getUnlocalizedName(); } public IProperty<?> getVariantProperty() { return VARIANT; } public Comparable<?> getTypeForItem(ItemStack stack) { return BlockVanillaSlab.Variant.DEFAULT; } public static enum Variant implements IStringSerializable { DEFAULT; public String getName() { return "default"; } } }
  12. Yes, i said 48 not considering the face property meta (so i just need a single generic class and every color has it's own block and id)
  13. Damn, this mean i will have 48 blocks instead of 3 with metas Ok, thanks for the tip, i guess i'll do like this
  14. How can i add this property to that functions?
  15. In my mod i have colored torches and lanterns, both sharing the same class (basically 3 blocks are sharing this class, the torch, the idle and the active lantern). Now, in the game everything works fine, the torch is placed as intended, as you can see by the image below But if i close the world and then re-open it, then this happens all torches are facing the same direction. This is the class i use package com.mwcolors.blocks.colors; import java.util.Iterator; import java.util.List; import java.util.Random; import com.google.common.base.Predicate; import com.mwcolors.core.MWColoredBlocks; import com.mwcolors.core.MWColoredModBlocks; import com.mwcolors.core.MWTabs; import net.minecraft.block.Block; import net.minecraft.block.BlockTorch; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.translation.I18n; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockColoredTorch extends BlockTorch { public static final PropertyEnum<EnumDyeColor> COLOR = PropertyEnum.<EnumDyeColor> create("color",EnumDyeColor.class); private boolean active; private boolean lantern; private EnumFacing facing; private EnumDyeColor color; public BlockColoredTorch(boolean active, boolean lantern) { super(); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(COLOR,EnumDyeColor.WHITE)); this.active = active; this.lantern = lantern; if (active && lantern) this.setCreativeTab((CreativeTabs) null); else this.setCreativeTab(MWTabs.tabColorsDecoration); if (lantern) this.setStepSound(SoundType.GLASS); else this.setStepSound(SoundType.WOOD); } /** * Gets the metadata of the item this Block can drop. This method is called * when the block gets destroyed. It returns the metadata of the dropped * item based on the old metadata of the block. */ public int damageDropped(IBlockState state) { return ((EnumDyeColor) state.getValue(COLOR)).getMetadata(); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return this.lantern ? Item.getItemFromBlock(MWColoredModBlocks.colored_lantern_idle) : Item.getItemFromBlock(MWColoredModBlocks.colored_flambeau_idle); } @Override public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(getItemDropped(state, new Random(), 0), 1, damageDropped(state)); } @Override public void randomDisplayTick(IBlockState worldIn, World pos, BlockPos state, Random rand) { if (this.active) super.randomDisplayTick(worldIn, pos, state, rand); } /** * returns a list of blocks with the same ID, but different meta (eg: wood * returns 4 blocks) */ @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) { for (EnumDyeColor enumdyecolor : EnumDyeColor.values()) { list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata())); } } /** * Get the MapColor for this Block and the given BlockState */ public MapColor getMapColor(IBlockState state) { return ((EnumDyeColor) state.getValue(COLOR)).getMapColor(); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta)); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((EnumDyeColor) state.getValue(COLOR)).getMetadata(); } protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { COLOR, FACING }); } private boolean canPlaceOn(World worldIn, BlockPos pos) { IBlockState state = worldIn.getBlockState(pos); if (state.isSideSolid(worldIn, pos, EnumFacing.UP)) { return true; } else { return state.getBlock().canPlaceTorchOnTop(state, worldIn, pos); } } private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing) { BlockPos blockpos = pos.offset(facing.getOpposite()); boolean flag = facing.getAxis().isHorizontal(); return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); } /** * Called by ItemBlocks just before a block is actually set in the world, to * allow for adjustments to the IBlockstate */ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { this.color = EnumDyeColor.byMetadata(meta); this.facing = facing; if (this.canPlaceAt(worldIn, pos, facing)) { return this.getDefaultState().withProperty(FACING, facing).withProperty(COLOR, EnumDyeColor.byMetadata(meta)); } else { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) { this.facing = enumfacing; return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(COLOR, EnumDyeColor.byMetadata(meta)); } } return this.getDefaultState(); } } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { if (this.active && this.lantern && worldIn.isBlockIndirectlyGettingPowered(pos) == 0) { worldIn.scheduleUpdate(pos, this, 4); worldIn.setBlockState(pos, MWColoredModBlocks.colored_lantern_idle.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(COLOR, state.getValue(COLOR))); } else if (!this.active && this.lantern && worldIn.isBlockIndirectlyGettingPowered(pos) != 0) { worldIn.setBlockState(pos, MWColoredModBlocks.colored_lantern_active.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(COLOR, this.color)); } } } /** * Called when a neighboring block changes. */ public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) { if (!worldIn.isRemote) { if (this.active && this.lantern && worldIn.isBlockIndirectlyGettingPowered(pos) == 0) { worldIn.scheduleUpdate(pos, this, 4); worldIn.setBlockState(pos, MWColoredModBlocks.colored_lantern_idle.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(COLOR, state.getValue(COLOR))); } else if (!this.active && this.lantern && worldIn.isBlockIndirectlyGettingPowered(pos) != 0) { worldIn.setBlockState(pos, MWColoredModBlocks.colored_lantern_active.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(COLOR, this.color)); } } } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { if (this.active && this.lantern && worldIn.isBlockIndirectlyGettingPowered(pos) == 0) { worldIn.scheduleUpdate(pos, this, 4); worldIn.setBlockState(pos, MWColoredModBlocks.colored_lantern_idle.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(COLOR, state.getValue(COLOR))); } } } @Override public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) { tooltip.add(TextFormatting.BLUE + I18n.translateToLocal("info.dyed") + ": " + I18n.translateToLocal(EnumDyeColor.byMetadata(stack.getMetadata()).getName())); } protected ItemStack createStackedBlock(IBlockState state) { return this.lantern ? new ItemStack(MWColoredModBlocks.colored_lantern_idle) : new ItemStack(MWColoredBlocks.colored_torch) ; } } Thanks in advance for the help
  16. I don't know if this will help, but this are all my json files blockstate { "variants": { "facing=east,half=bottom,shape=straight": { "model": "mw:aluminium_stairs" }, "facing=west,half=bottom,shape=straight": { "model": "mw:aluminium_stairs", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=straight": { "model": "mw:aluminium_stairs", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=straight": { "model": "mw:aluminium_stairs", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=outer_right": { "model": "mw:aluminium_outer_stairs" }, "facing=west,half=bottom,shape=outer_right": { "model": "mw:aluminium_outer_stairs", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=outer_right": { "model": "mw:aluminium_outer_stairs", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=outer_right": { "model": "mw:aluminium_outer_stairs", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=outer_left": { "model": "mw:aluminium_outer_stairs", "y": 270, "uvlock": true }, "facing=west,half=bottom,shape=outer_left": { "model": "mw:aluminium_outer_stairs", "y": 90, "uvlock": true }, "facing=south,half=bottom,shape=outer_left": { "model": "mw:aluminium_outer_stairs" }, "facing=north,half=bottom,shape=outer_left": { "model": "mw:aluminium_outer_stairs", "y": 180, "uvlock": true }, "facing=east,half=bottom,shape=inner_right": { "model": "mw:aluminium_inner_stairs" }, "facing=west,half=bottom,shape=inner_right": { "model": "mw:aluminium_inner_stairs", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=inner_right": { "model": "mw:aluminium_inner_stairs", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=inner_right": { "model": "mw:aluminium_inner_stairs", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=inner_left": { "model": "mw:aluminium_inner_stairs", "y": 270, "uvlock": true }, "facing=west,half=bottom,shape=inner_left": { "model": "mw:aluminium_inner_stairs", "y": 90, "uvlock": true }, "facing=south,half=bottom,shape=inner_left": { "model": "mw:aluminium_inner_stairs" }, "facing=north,half=bottom,shape=inner_left": { "model": "mw:aluminium_inner_stairs", "y": 180, "uvlock": true }, "facing=east,half=top,shape=straight": { "model": "mw:aluminium_stairs", "x": 180, "uvlock": true }, "facing=west,half=top,shape=straight": { "model": "mw:aluminium_stairs", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=straight": { "model": "mw:aluminium_stairs", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=straight": { "model": "mw:aluminium_stairs", "x": 180, "y": 270, "uvlock": true }, "facing=east,half=top,shape=outer_right": { "model": "mw:aluminium_outer_stairs", "x": 180, "y": 90, "uvlock": true }, "facing=west,half=top,shape=outer_right": { "model": "mw:aluminium_outer_stairs", "x": 180, "y": 270, "uvlock": true }, "facing=south,half=top,shape=outer_right": { "model": "mw:aluminium_outer_stairs", "x": 180, "y": 180, "uvlock": true }, "facing=north,half=top,shape=outer_right": { "model": "mw:aluminium_outer_stairs", "x": 180, "uvlock": true }, "facing=east,half=top,shape=outer_left": { "model": "mw:aluminium_outer_stairs", "x": 180, "uvlock": true }, "facing=west,half=top,shape=outer_left": { "model": "mw:aluminium_outer_stairs", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=outer_left": { "model": "mw:aluminium_outer_stairs", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=outer_left": { "model": "mw:aluminium_outer_stairs", "x": 180, "y": 270, "uvlock": true }, "facing=east,half=top,shape=inner_right": { "model": "mw:aluminium_inner_stairs", "x": 180, "y": 90, "uvlock": true }, "facing=west,half=top,shape=inner_right": { "model": "mw:aluminium_inner_stairs", "x": 180, "y": 270, "uvlock": true }, "facing=south,half=top,shape=inner_right": { "model": "mw:aluminium_inner_stairs", "x": 180, "y": 180, "uvlock": true }, "facing=north,half=top,shape=inner_right": { "model": "mw:aluminium_inner_stairs", "x": 180, "uvlock": true }, "facing=east,half=top,shape=inner_left": { "model": "mw:aluminium_inner_stairs", "x": 180, "uvlock": true }, "facing=west,half=top,shape=inner_left": { "model": "mw:aluminium_inner_stairs", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=inner_left": { "model": "mw:aluminium_inner_stairs", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=inner_left": { "model": "mw:aluminium_inner_stairs", "x": 180, "y": 270, "uvlock": true } } } Item { "parent": "mw:block/aluminium_stairs" } Block models normal { "parent": "block/stairs", "textures": { "bottom": "mw:blocks/aluminium_block", "top": "mw:blocks/aluminium_block", "side": "mw:blocks/aluminium_block" } } inner { "parent": "block/inner_stairs", "textures": { "bottom": "mw:blocks/aluminium_block", "top": "mw:blocks/aluminium_block", "side": "mw:blocks/aluminium_block" } } outer { "parent": "block/outer_stairs", "textures": { "bottom": "mw:blocks/aluminium_block", "top": "mw:blocks/aluminium_block", "side": "mw:blocks/aluminium_block" } }
  17. Adding the mod as library has solved the issue, thanks for your help
  18. I have a mod that will check if another mod is loaded in the game. So i've put this mod into the "run" folder of the project and launched the game. The mod is recognized as loaded, but for some reason the game crash, giving me this error related to that other mod (the mod i want to check is loaded) [13:21:22] [Client thread/ERROR] [FML]: The following problems were captured during this phase [13:21:22] [Client thread/ERROR] [FML]: Caught exception from mw java.lang.NoClassDefFoundError: com/mineworld/blocks/plants/BlockSaplingMW at com.mineworld.MW.preInit(MW.java:34) ~[MW.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_74] at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:561) ~[forgeSrc-1.9-12.16.1.1887.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_74] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228) ~[forgeSrc-1.9-12.16.1.1887.jar:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206) ~[forgeSrc-1.9-12.16.1.1887.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_74] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) [LoadController.class:?] at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:584) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:472) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:381) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_74] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_74] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.ClassNotFoundException: com.mineworld.blocks.plants.BlockSaplingMW at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_74] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_74] ... 44 more Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.mineworld.world.gen.feature.WorldGenChristmasTree at org.objectweb.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1684) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassWriter.getMergedType(ClassWriter.java:1654) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.Frame.merge(Frame.java:1426) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.Frame.merge(Frame.java:1325) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1475) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.commons.LocalVariablesSorter.visitMaxs(LocalVariablesSorter.java:170) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1554) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1017) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassReader.accept(ClassReader.java:693) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassReader.accept(ClassReader.java:506) ~[asm-debug-all-5.0.3.jar:5.0.3] at net.minecraftforge.fml.common.asm.transformers.DeobfuscationTransformer.transform(DeobfuscationTransformer.java:44) ~[forgeSrc-1.9-12.16.1.1887.jar:?] at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_74] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_74] ... 44 more I've tried loading this mod in Minecraft and everything works fine, this error only occurs if i try to load it from eclipse? Any idea of what's causing this?
  19. 1: yes, i'm cd-ing in the right folder 2: i don't know what to change, since in game the slabs works as well 3: I've just created a new folder with a fresh installation of the Recommended 1.9 forge release and then copied the src code from previous folder (previous 1.9 forge release) EDIT: looks like the problem is this public static final PropertyEnum<BlockOreSlab.EnumType> VARIANT = PropertyEnum.<BlockOreSlab .EnumType> create("variant", BlockOreSlab.EnumType.class); because instead formatting like this public static final PropertyEnum<BlockOreSlab.EnumType> VARIANT = PropertyEnum.<BlockOreSlab.EnumType> create("variant", BlockOreSlab.EnumType.class); let me export the mod Thanks everybody for the help
  20. By doing this public EntityColoredOakBoat(World worldIn) { super(worldIn); } public EntityColoredOakBoat(World worldIn, double x, double y, double z) { super(worldIn, x, y, z); } public Item getItemBoat() { switch (this.getBoatType()) { case OAK: default: return MWColoredBoats.colored_oak_boat_white; case SPRUCE: return MWColoredBoats.colored_spruce_boat_white; case BIRCH: return MWColoredBoats.colored_birch_boat_white; case JUNGLE: return MWColoredBoats.colored_jungle_boat_white; case ACACIA: return MWColoredBoats.colored_acacia_boat_white; case DARK_OAK: return MWColoredBoats.colored_dark_oak_boat_white; } } everything works, so not overriding the type enum all works fine, but i can't understand why I've tried renaming that method, to don't override the Vanilla one, but it gives me a NullPointerException on the setBoatType function
  21. I know, but as i said i've tried extending the EntityBoat class, by doing this package com.mineworld.entity.colors; import com.mineworld.core.MWColoredBoats; import net.minecraft.entity.item.EntityBoat; import net.minecraft.item.Item; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.world.World; public class EntityColoredOakBoat extends EntityBoat{ private static final DataParameter<Integer> BOAT_TYPE = EntityDataManager.<Integer>createKey(EntityColoredOakBoat.class, DataSerializers.VARINT); public EntityColoredOakBoat(World worldIn) { super(worldIn); } public Item getItemBoat() { switch (this.getBoatType()) { case WHITE: return MWColoredBoats.colored_oak_boat_white; case ORANGE: return MWColoredBoats.colored_oak_boat_orange; case MAGENTA: return MWColoredBoats.colored_oak_boat_magenta; case LIGHT_BLUE: return MWColoredBoats.colored_oak_boat_light_blue; case YELLOW: return MWColoredBoats.colored_oak_boat_yellow; case LIME: return MWColoredBoats.colored_oak_boat_lime; case PINK: return MWColoredBoats.colored_oak_boat_pink; case GRAY: return MWColoredBoats.colored_oak_boat_gray; case SILVER: return MWColoredBoats.colored_oak_boat_silver; case CYAN: return MWColoredBoats.colored_oak_boat_cyan; case PURPLE: return MWColoredBoats.colored_oak_boat_purple; case BLUE: return MWColoredBoats.colored_oak_boat_blue; case BROWN: return MWColoredBoats.colored_oak_boat_brown; case GREEN: return MWColoredBoats.colored_oak_boat_green; case RED: return MWColoredBoats.colored_oak_boat_red; case BLACK: return MWColoredBoats.colored_oak_boat_black; default: return MWColoredBoats.colored_oak_boat_white; } } public void setBoatType(EntityColoredOakBoat.Type boatType) { this.dataWatcher.set(BOAT_TYPE, Integer.valueOf(boatType.ordinal())); } public EntityColoredOakBoat.Type getBoatType() { return EntityColoredOakBoat.Type.byId(((Integer)this.dataWatcher.get(BOAT_TYPE)).intValue()); } public static enum Type { WHITE(0, "white"), ORANGE(1, "orange"), MAGENTA(2, "magenta"), LIGHT_BLUE(3, "light_blue"), YELLOW(4, "yellow"), LIME(5, "lime"), PINK(6, "pink"), GRAY(7, "gray"), SILVER(8, "silver"), CYAN(9, "cyan"), PURPLE(10, "purple"), BLUE(11, "blue"), BROWN(12, "brown"), GREEN(13, "green"), RED(14, "red"), BLACK(15, "black"); private final String name; private final int metadata; private Type(int metadataIn, String nameIn) { this.name = nameIn; this.metadata = metadataIn; } public String getName() { return this.name; } public int getMetadata() { return this.metadata; } public String toString() { return this.name; } /** * Get a boat type by it's enum ordinal */ public static EntityColoredOakBoat.Type byId(int id) { if (id < 0 || id >= values().length) { id = 0; } return values()[id]; } public static EntityColoredOakBoat.Type getTypeFromString(String nameIn) { for (int i = 0; i < values().length; ++i) { if (values()[i].getName().equals(nameIn)) { return values()[i]; } } return values()[0]; } } } Overriding just the Type class and it's related methods, but i can't find a way to use the function getBoatType(), because eclipse says "The return type is incompatible with EntityBoat.getBoatType()"
  22. I was goign to export my mod, but when doing the gradlew build command this error comes out This is the class referenced by the error, in eclipse and in the game it gives me no error package com.mineworld.blocks.ores; import java.util.List; import java.util.Random; import com.mineworld.core.MWMetadataBlocks; import com.mineworld.core.MWTabs; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public abstract class BlockOreSlab extends BlockSlab { public static final PropertyBool SEAMLESS = PropertyBool.create("seamless"); public static final PropertyEnum<BlockOreSlab.EnumType> VARIANT = PropertyEnum.<BlockOreSlab .EnumType> create("variant", BlockOreSlab.EnumType.class); public BlockOreSlab() { super(Material.rock); IBlockState iblockstate = this.blockState.getBaseState(); if (this.isDouble()) { iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf(false)); } else { iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); } this.setDefaultState(iblockstate.withProperty(VARIANT, BlockOreSlab.EnumType.RUBY)); this.setCreativeTab(MWTabs.tabBlock); this.setHardness(2.0F); this.setResistance(15.0F); this.useNeighborBrightness = !this.isDouble(); } /** * Get the Item that this Block should drop when harvested. */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(MWMetadataBlocks.ore_slab); } public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(MWMetadataBlocks.ore_slab, 1, ((BlockOreSlab.EnumType) state.getValue(VARIANT)).getMetadata()); } /** * Returns the slab block name with the type associated with it */ public String getUnlocalizedName(int meta) { return "tile." + BlockOreSlab.EnumType.byMetadata(meta).getName() + "_slab"; } public IProperty<?> getVariantProperty() { return VARIANT; } public Comparable<?> getTypeForItem(ItemStack stack) { return BlockOreSlab.EnumType.byMetadata(stack.getMetadata() & 7); } /** * returns a list of blocks with the same ID, but different meta (eg: wood * returns 4 blocks) */ @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) { if (itemIn != Item.getItemFromBlock(MWMetadataBlocks.ore_double_slab)) { for (BlockOreSlab.EnumType blockstoneslab$enumtype : BlockOreSlab.EnumType.values()) { list.add(new ItemStack(itemIn, 1, blockstoneslab$enumtype.getMetadata())); } } } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockOreSlab.EnumType.byMetadata(meta & 7)); if (this.isDouble()) { iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf((meta & != 0)); } else { iblockstate = iblockstate.withProperty(HALF, (meta & == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { int i = 0; i = i | ((BlockOreSlab.EnumType) state.getValue(VARIANT)).getMetadata(); if (this.isDouble()) { if (((Boolean) state.getValue(SEAMLESS)).booleanValue()) { i |= 8; } } else if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { i |= 8; } return i; } protected BlockStateContainer createBlockState() { return this.isDouble() ? new BlockStateContainer(this, new IProperty[] { SEAMLESS, VARIANT }) : new BlockStateContainer(this, new IProperty[] { HALF, VARIANT }); } /** * Gets the metadata of the item this Block can drop. This method is called * when the block gets destroyed. It returns the metadata of the dropped * item based on the old metadata of the block. */ public int damageDropped(IBlockState state) { return ((BlockOreSlab.EnumType) state.getValue(VARIANT)).getMetadata(); } /** * Get the MapColor for this Block and the given BlockState */ public MapColor getMapColor(IBlockState state) { return ((BlockOreSlab.EnumType) state.getValue(VARIANT)).getMapColor(); } @Override public boolean canProvidePower(IBlockState state) { return state.getValue(VARIANT).equals(BlockOreSlab.EnumType.COPPER) || state.getValue(VARIANT).equals(BlockOreSlab.EnumType.BRONZE); } @Override public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { if (blockState.getValue(VARIANT).equals(BlockOreSlab.EnumType.COPPER)) return 10; else if (blockState.getValue(VARIANT).equals(BlockOreSlab.EnumType.BRONZE)) return 5; else return 0; } @Override public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) { return side == EnumFacing.UP; } public static enum EnumType implements IStringSerializable { RUBY(0, MapColor.tntColor, "ruby"), SAPPHIRE(1, MapColor.blueColor, "sapphire"), COPPER(2, MapColor.tntColor, "copper"), BRONZE(3, MapColor.tntColor, "bronze"), SILVER(4, MapColor.lightBlueColor, "silver"), ALUMINIUM(5, MapColor.silverColor, "aluminium"), WHITE_MARBLE(6, MapColor.quartzColor, "white_marble"), PINK_MARBLE(7, MapColor.pinkColor, "pink_marble"); private static final BlockOreSlab.EnumType[] META_LOOKUP = new BlockOreSlab.EnumType[values().length]; private final int meta; private final MapColor color; private final String name; private final String unlocalizedName; private EnumType(int meta, MapColor mapColor, String name) { this(meta, mapColor, name, name); } private EnumType(int meta, MapColor mapColor, String name, String unlocalizedName) { this.meta = meta; this.color = mapColor; this.name = name; this.unlocalizedName = unlocalizedName; } public int getMetadata() { return this.meta; } public MapColor getMapColor() { return this.color; } public String toString() { return this.name; } public static BlockOreSlab.EnumType byMetadata(int meta) { if (meta < 0 || meta >= META_LOOKUP.length) { meta = 0; } return META_LOOKUP[meta]; } public String getName() { return this.name; } public String getUnlocalizedName() { return this.unlocalizedName; } static { for (BlockOreSlab.EnumType type : values()) { META_LOOKUP[type.getMetadata()] = type; } } } } It's almost the same code i used in 1.8 and when building there it doesn't give me this error, any idea about what it's causing this?
  23. Up Any thoughts on this?
  24. I've tried copy/paste the EntityBoat class to make a Oak Boat in all the 16 colors. The boat entity renders fine, and the player can sit in it. However when trying to move, the boat isn't moving. So this is the class, as i said it's just a copy/paste of the EntityBoat class, so something have a weird name, the only things changed are the BoatTypes, wich are now the 16 colors package com.mineworld.entity.colors; import com.google.common.collect.Lists; import com.mineworld.core.MWColoredBlocks; import com.mineworld.core.MWColoredBoats; import java.util.List; import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockPlanks; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityWaterMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.network.play.client.CPacketSteerBoat; import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.util.EntitySelectors; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityColoredOakBoat extends Entity { private static final DataParameter<Integer> TIME_SINCE_HIT = EntityDataManager.<Integer>createKey(EntityColoredOakBoat.class, DataSerializers.VARINT); private static final DataParameter<Integer> FORWARD_DIRECTION = EntityDataManager.<Integer>createKey(EntityColoredOakBoat.class, DataSerializers.VARINT); private static final DataParameter<Float> DAMAGE_TAKEN = EntityDataManager.<Float>createKey(EntityColoredOakBoat.class, DataSerializers.FLOAT); private static final DataParameter<Integer> BOAT_TYPE = EntityDataManager.<Integer>createKey(EntityColoredOakBoat.class, DataSerializers.VARINT); private static final DataParameter<Boolean>[] field_184468_e = new DataParameter[] {EntityDataManager.createKey(EntityColoredOakBoat.class, DataSerializers.BOOLEAN), EntityDataManager.createKey(EntityColoredOakBoat.class, DataSerializers.BOOLEAN)}; private float[] field_184470_f; /** How much of current speed to retain. Value zero to one. */ private float momentum; private float field_184474_h; private float field_184475_as; private int field_184476_at; private double boatPitch; private double field_184477_av; private double field_184478_aw; private double boatYaw; private double field_184479_ay; private boolean field_184480_az; private boolean field_184459_aA; private boolean field_184461_aB; private boolean field_184463_aC; private double field_184465_aD; /** * How much the boat should glide given the slippery blocks it's currently gliding over. * Halved every tick. */ private float boatGlide; private EntityColoredOakBoat.Status status; private EntityColoredOakBoat.Status previousStatus; private double field_184473_aH; public EntityColoredOakBoat(World worldIn) { super(worldIn); this.field_184470_f = new float[2]; this.preventEntitySpawning = true; this.setSize(1.375F, 0.5625F); } public EntityColoredOakBoat(World worldIn, double x, double y, double z) { this(worldIn); this.setPosition(x, y, z); this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.prevPosX = x; this.prevPosY = y; this.prevPosZ = z; } /** * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to * prevent them from trampling crops */ protected boolean canTriggerWalking() { return false; } protected void entityInit() { this.dataWatcher.register(TIME_SINCE_HIT, Integer.valueOf(0)); this.dataWatcher.register(FORWARD_DIRECTION, Integer.valueOf(1)); this.dataWatcher.register(DAMAGE_TAKEN, Float.valueOf(0.0F)); this.dataWatcher.register(BOAT_TYPE, Integer.valueOf(EntityColoredOakBoat.Type.WHITE.ordinal())); for (int i = 0; i < field_184468_e.length; ++i) { this.dataWatcher.register(field_184468_e[i], Boolean.valueOf(false)); } } /** * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be * pushable on contact, like boats or minecarts. */ public AxisAlignedBB getCollisionBox(Entity entityIn) { return entityIn.getEntityBoundingBox(); } /** * Returns the collision bounding box for this entity */ public AxisAlignedBB getCollisionBoundingBox() { return this.getEntityBoundingBox(); } /** * Returns true if this entity should push and be pushed by other entities when colliding. */ public boolean canBePushed() { return true; } /** * Returns the Y offset from the entity's position for any entity riding this one. */ public double getMountedYOffset() { return -0.1D; } /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource source, float amount) { if (this.isEntityInvulnerable(source)) { return false; } else if (!this.worldObj.isRemote && !this.isDead) { if (source instanceof EntityDamageSourceIndirect && source.getEntity() != null && this.isPassenger(source.getEntity())) { return false; } else { this.setForwardDirection(-this.getForwardDirection()); this.setTimeSinceHit(10); this.setDamageTaken(this.getDamageTaken() + amount * 10.0F); this.setBeenAttacked(); boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode; if (flag || this.getDamageTaken() > 40.0F) { if (!flag && this.worldObj.getGameRules().getBoolean("doEntityDrops")) { this.dropItemWithOffset(this.getItemBoat(), 1, 0.0F); } this.setDead(); } return true; } } else { return true; } } /** * Applies a velocity to each of the entities pushing them away from each other. Args: entity */ public void applyEntityCollision(Entity entityIn) { if (entityIn instanceof EntityColoredOakBoat) { if (entityIn.getEntityBoundingBox().minY < this.getEntityBoundingBox().maxY) { super.applyEntityCollision(entityIn); } } else if (entityIn.getEntityBoundingBox().minY <= this.getEntityBoundingBox().minY) { super.applyEntityCollision(entityIn); } } /** * Setups the entity to do the hurt animation. Only used by packets in multiplayer. */ @SideOnly(Side.CLIENT) public void performHurtAnimation() { this.setForwardDirection(-this.getForwardDirection()); this.setTimeSinceHit(10); this.setDamageTaken(this.getDamageTaken() * 11.0F); } /** * Returns true if other Entities should be prevented from moving through this Entity. */ public boolean canBeCollidedWith() { return !this.isDead; } @SideOnly(Side.CLIENT) public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) { this.boatPitch = x; this.field_184477_av = y; this.field_184478_aw = z; this.boatYaw = (double)yaw; this.field_184479_ay = (double)pitch; this.field_184476_at = 10; } /** * Gets the horizontal facing direction of this Entity, adjusted to take specially-treated entity types into * account. */ public EnumFacing getAdjustedHorizontalFacing() { return this.getHorizontalFacing().rotateY(); } /** * Called to update the entity's position/logic. */ public void onUpdate() { this.previousStatus = this.status; this.status = this.getBoatStatus(); if (this.status != EntityColoredOakBoat.Status.UNDER_WATER && this.status != EntityColoredOakBoat.Status.UNDER_FLOWING_WATER) { this.field_184474_h = 0.0F; } else { ++this.field_184474_h; } if (!this.worldObj.isRemote && this.field_184474_h >= 60.0F) { this.removePassengers(); } if (this.getTimeSinceHit() > 0) { this.setTimeSinceHit(this.getTimeSinceHit() - 1); } if (this.getDamageTaken() > 0.0F) { this.setDamageTaken(this.getDamageTaken() - 1.0F); } this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; super.onUpdate(); this.func_184447_s(); if (this.canPassengerSteer()) { if (this.getPassengers().size() == 0 || !(this.getPassengers().get(0) instanceof EntityPlayer)) { this.func_184445_a(false, false); } this.updateMotion(); if (this.worldObj.isRemote) { this.func_184443_x(); this.worldObj.sendPacketToServer(new CPacketSteerBoat(this.func_184457_a(0), this.func_184457_a(1))); } this.moveEntity(this.motionX, this.motionY, this.motionZ); } else { this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; } for (int i = 0; i <= 1; ++i) { if (this.func_184457_a(i)) { this.field_184470_f[i] = (float)((double)this.field_184470_f[i] + 0.01D); } else { this.field_184470_f[i] = 0.0F; } } this.doBlockCollisions(); List<Entity> list = this.worldObj.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().expand(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelectors.<Entity>func_188442_a(this)); if (!list.isEmpty()) { boolean flag = !this.worldObj.isRemote && !(this.getControllingPassenger() instanceof EntityPlayer); for (int j = 0; j < list.size(); ++j) { Entity entity = (Entity)list.get(j); if (!entity.isPassenger(this)) { if (flag && this.getPassengers().size() < 2 && !entity.isRiding() && entity.width < this.width && entity instanceof EntityLivingBase && !(entity instanceof EntityWaterMob) && !(entity instanceof EntityPlayer)) { entity.startRiding(this); } else { this.applyEntityCollision(entity); } } } } } private void func_184447_s() { if (this.field_184476_at > 0 && !this.canPassengerSteer()) { double d0 = this.posX + (this.boatPitch - this.posX) / (double)this.field_184476_at; double d1 = this.posY + (this.field_184477_av - this.posY) / (double)this.field_184476_at; double d2 = this.posZ + (this.field_184478_aw - this.posZ) / (double)this.field_184476_at; double d3 = MathHelper.wrapAngleTo180_double(this.boatYaw - (double)this.rotationYaw); this.rotationYaw = (float)((double)this.rotationYaw + d3 / (double)this.field_184476_at); this.rotationPitch = (float)((double)this.rotationPitch + (this.field_184479_ay - (double)this.rotationPitch) / (double)this.field_184476_at); --this.field_184476_at; this.setPosition(d0, d1, d2); this.setRotation(this.rotationYaw, this.rotationPitch); } } public void func_184445_a(boolean p_184445_1_, boolean p_184445_2_) { this.dataWatcher.set(field_184468_e[0], Boolean.valueOf(p_184445_1_)); this.dataWatcher.set(field_184468_e[1], Boolean.valueOf(p_184445_2_)); } @SideOnly(Side.CLIENT) public float func_184448_a(int p_184448_1_, float limbSwing) { return this.func_184457_a(p_184448_1_) ? (float)MathHelper.denormalizeClamp((double)this.field_184470_f[p_184448_1_] - 0.01D, (double)this.field_184470_f[p_184448_1_], (double)limbSwing) : 0.0F; } /** * Determines whether the boat is in water, gliding on land, or in air */ private EntityColoredOakBoat.Status getBoatStatus() { EntityColoredOakBoat.Status entityboat$status = this.getUnderwaterStatus(); if (entityboat$status != null) { this.field_184465_aD = this.getEntityBoundingBox().maxY; return entityboat$status; } else if (this.func_184446_u()) { return EntityColoredOakBoat.Status.IN_WATER; } else { float f = this.getBoatGlide(); if (f > 0.0F) { this.boatGlide = f; return EntityColoredOakBoat.Status.ON_LAND; } else { return EntityColoredOakBoat.Status.IN_AIR; } } } public float func_184451_k() { AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); int i = MathHelper.floor_double(axisalignedbb.minX); int j = MathHelper.ceiling_double_int(axisalignedbb.maxX); int k = MathHelper.floor_double(axisalignedbb.maxY); int l = MathHelper.ceiling_double_int(axisalignedbb.maxY - this.field_184473_aH); int i1 = MathHelper.floor_double(axisalignedbb.minZ); int j1 = MathHelper.ceiling_double_int(axisalignedbb.maxZ); BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); try { label78: for (int k1 = k; k1 < l; ++k1) { float f = 0.0F; int l1 = i; while (true) { if (l1 >= j) { if (f < 1.0F) { float f2 = (float)blockpos$pooledmutableblockpos.getY() + f; return f2; } break; } for (int i2 = i1; i2 < j1; ++i2) { blockpos$pooledmutableblockpos.set(l1, k1, i2); IBlockState iblockstate = this.worldObj.getBlockState(blockpos$pooledmutableblockpos); if (iblockstate.getMaterial() == Material.water) { f = Math.max(f, func_184456_a(iblockstate, this.worldObj, blockpos$pooledmutableblockpos)); } if (f >= 1.0F) { continue label78; } } ++l1; } } float f1 = (float)(l + 1); return f1; } finally { blockpos$pooledmutableblockpos.release(); } } /** * Decides how much the boat should be gliding on the land (based on any slippery blocks) */ public float getBoatGlide() { AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY - 0.001D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); int i = MathHelper.floor_double(axisalignedbb1.minX) - 1; int j = MathHelper.ceiling_double_int(axisalignedbb1.maxX) + 1; int k = MathHelper.floor_double(axisalignedbb1.minY) - 1; int l = MathHelper.ceiling_double_int(axisalignedbb1.maxY) + 1; int i1 = MathHelper.floor_double(axisalignedbb1.minZ) - 1; int j1 = MathHelper.ceiling_double_int(axisalignedbb1.maxZ) + 1; List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList(); float f = 0.0F; int k1 = 0; BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); try { for (int l1 = i; l1 < j; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { int j2 = (l1 != i && l1 != j - 1 ? 0 : 1) + (i2 != i1 && i2 != j1 - 1 ? 0 : 1); if (j2 != 2) { for (int k2 = k; k2 < l; ++k2) { if (j2 <= 0 || k2 != k && k2 != l - 1) { blockpos$pooledmutableblockpos.set(l1, k2, i2); IBlockState iblockstate = this.worldObj.getBlockState(blockpos$pooledmutableblockpos); iblockstate.addCollisionBoxToList(this.worldObj, blockpos$pooledmutableblockpos, axisalignedbb1, list, this); if (!list.isEmpty()) { f += iblockstate.getBlock().slipperiness; ++k1; } list.clear(); } } } } } } finally { blockpos$pooledmutableblockpos.release(); } return f / (float)k1; } private boolean func_184446_u() { AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); int i = MathHelper.floor_double(axisalignedbb.minX); int j = MathHelper.ceiling_double_int(axisalignedbb.maxX); int k = MathHelper.floor_double(axisalignedbb.minY); int l = MathHelper.ceiling_double_int(axisalignedbb.minY + 0.001D); int i1 = MathHelper.floor_double(axisalignedbb.minZ); int j1 = MathHelper.ceiling_double_int(axisalignedbb.maxZ); boolean flag = false; this.field_184465_aD = Double.MIN_VALUE; BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); try { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { blockpos$pooledmutableblockpos.set(k1, l1, i2); IBlockState iblockstate = this.worldObj.getBlockState(blockpos$pooledmutableblockpos); if (iblockstate.getMaterial() == Material.water) { float f = func_184452_b(iblockstate, this.worldObj, blockpos$pooledmutableblockpos); this.field_184465_aD = Math.max((double)f, this.field_184465_aD); flag |= axisalignedbb.minY < (double)f; } } } } } finally { blockpos$pooledmutableblockpos.release(); } return flag; } /** * Decides whether the boat is currently underwater. */ private EntityColoredOakBoat.Status getUnderwaterStatus() { AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); double d0 = axisalignedbb.maxY + 0.001D; int i = MathHelper.floor_double(axisalignedbb.minX); int j = MathHelper.ceiling_double_int(axisalignedbb.maxX); int k = MathHelper.floor_double(axisalignedbb.maxY); int l = MathHelper.ceiling_double_int(d0); int i1 = MathHelper.floor_double(axisalignedbb.minZ); int j1 = MathHelper.ceiling_double_int(axisalignedbb.maxZ); boolean flag = false; BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); try { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { blockpos$pooledmutableblockpos.set(k1, l1, i2); IBlockState iblockstate = this.worldObj.getBlockState(blockpos$pooledmutableblockpos); if (iblockstate.getMaterial() == Material.water && d0 < (double)func_184452_b(iblockstate, this.worldObj, blockpos$pooledmutableblockpos)) { if (((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() != 0) { EntityColoredOakBoat.Status entityboat$status = EntityColoredOakBoat.Status.UNDER_FLOWING_WATER; return entityboat$status; } flag = true; } } } } } finally { blockpos$pooledmutableblockpos.release(); } return flag ? EntityColoredOakBoat.Status.UNDER_WATER : null; } public static float func_184456_a(IBlockState p_184456_0_, IBlockAccess p_184456_1_, BlockPos p_184456_2_) { int i = ((Integer)p_184456_0_.getValue(BlockLiquid.LEVEL)).intValue(); return (i & 7) == 0 && p_184456_1_.getBlockState(p_184456_2_.up()).getMaterial() == Material.water ? 1.0F : 1.0F - BlockLiquid.getLiquidHeightPercent(i); } public static float func_184452_b(IBlockState p_184452_0_, IBlockAccess p_184452_1_, BlockPos p_184452_2_) { return (float)p_184452_2_.getY() + func_184456_a(p_184452_0_, p_184452_1_, p_184452_2_); } /** * Update the boat's speed, based on momentum. */ private void updateMotion() { double d0 = -0.03999999910593033D; double d1 = d0; double d2 = 0.0D; this.momentum = 0.05F; if (this.previousStatus == EntityColoredOakBoat.Status.IN_AIR && this.status != EntityColoredOakBoat.Status.IN_AIR && this.status != EntityColoredOakBoat.Status.ON_LAND) { this.field_184465_aD = this.getEntityBoundingBox().minY + (double)this.height; this.setPosition(this.posX, (double)(this.func_184451_k() - this.height) + 0.101D, this.posZ); this.motionY = 0.0D; this.field_184473_aH = 0.0D; this.status = EntityColoredOakBoat.Status.IN_WATER; } else { if (this.status == EntityColoredOakBoat.Status.IN_WATER) { d2 = (this.field_184465_aD - this.getEntityBoundingBox().minY) / (double)this.height; this.momentum = 0.9F; } else if (this.status == EntityColoredOakBoat.Status.UNDER_FLOWING_WATER) { d1 = -7.0E-4D; this.momentum = 0.9F; } else if (this.status == EntityColoredOakBoat.Status.UNDER_WATER) { d2 = 0.009999999776482582D; this.momentum = 0.45F; } else if (this.status == EntityColoredOakBoat.Status.IN_AIR) { this.momentum = 0.9F; } else if (this.status == EntityColoredOakBoat.Status.ON_LAND) { this.momentum = this.boatGlide; if (this.getControllingPassenger() instanceof EntityPlayer) { this.boatGlide /= 2.0F; } } this.motionX *= (double)this.momentum; this.motionZ *= (double)this.momentum; this.field_184475_as *= this.momentum; this.motionY += d1; if (d2 > 0.0D) { double d3 = 0.65D; this.motionY += d2 * (-d0 / 0.65D); double d4 = 0.75D; this.motionY *= 0.75D; } } } private void func_184443_x() { if (this.isBeingRidden()) { float f = 0.0F; if (this.field_184480_az) { this.field_184475_as += -1.0F; } if (this.field_184459_aA) { ++this.field_184475_as; } if (this.field_184459_aA != this.field_184480_az && !this.field_184461_aB && !this.field_184463_aC) { f += 0.005F; } this.rotationYaw += this.field_184475_as; if (this.field_184461_aB) { f += 0.04F; } if (this.field_184463_aC) { f -= 0.005F; } this.motionX += (double)(MathHelper.sin(-this.rotationYaw * 0.017453292F) * f); this.motionZ += (double)(MathHelper.cos(this.rotationYaw * 0.017453292F) * f); this.func_184445_a(this.field_184459_aA || this.field_184461_aB, this.field_184480_az || this.field_184461_aB); } } public void updatePassenger(Entity passenger) { if (this.isPassenger(passenger)) { float f = 0.0F; float f1 = (float)((this.isDead ? 0.009999999776482582D : this.getMountedYOffset()) + passenger.getYOffset()); if (this.getPassengers().size() > 1) { int i = this.getPassengers().indexOf(passenger); if (i == 0) { f = 0.2F; } else { f = -0.6F; } if (passenger instanceof EntityAnimal) { f = (float)((double)f + 0.2D); } } Vec3d vec3d = (new Vec3d((double)f, 0.0D, 0.0D)).rotateYaw(-this.rotationYaw * 0.017453292F - ((float)Math.PI / 2F)); passenger.setPosition(this.posX + vec3d.xCoord, this.posY + (double)f1, this.posZ + vec3d.zCoord); passenger.rotationYaw += this.field_184475_as; passenger.setRotationYawHead(passenger.getRotationYawHead() + this.field_184475_as); this.applyYawToEntity(passenger); if (passenger instanceof EntityAnimal && this.getPassengers().size() > 1) { int j = passenger.getEntityId() % 2 == 0 ? 90 : 270; passenger.setRenderYawOffset(((EntityAnimal)passenger).renderYawOffset + (float)j); passenger.setRotationYawHead(passenger.getRotationYawHead() + (float)j); } } } /** * Applies this boat's yaw to the given entity. Used to update the orientation of its passenger. */ protected void applyYawToEntity(Entity entityToUpdate) { entityToUpdate.setRenderYawOffset(this.rotationYaw); float f = MathHelper.wrapAngleTo180_float(entityToUpdate.rotationYaw - this.rotationYaw); float f1 = MathHelper.clamp_float(f, -105.0F, 105.0F); entityToUpdate.prevRotationYaw += f1 - f; entityToUpdate.rotationYaw += f1 - f; entityToUpdate.setRotationYawHead(entityToUpdate.rotationYaw); } /** * Applies this entity's orientation (pitch/yaw) to another entity. Used to update passenger orientation. */ @SideOnly(Side.CLIENT) public void applyOrientationToEntity(Entity entityToUpdate) { this.applyYawToEntity(entityToUpdate); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ protected void writeEntityToNBT(NBTTagCompound tagCompound) { tagCompound.setString("Type", this.getBoatType().getName()); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ protected void readEntityFromNBT(NBTTagCompound tagCompund) { if (tagCompund.hasKey("Type", ) { this.setBoatType(EntityColoredOakBoat.Type.getTypeFromString(tagCompund.getString("Type"))); } } public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { if (!this.worldObj.isRemote && !player.isSneaking() && this.field_184474_h < 60.0F) { player.startRiding(this); } return true; } protected void updateFallState(double y, boolean onGroundIn, IBlockState state, BlockPos pos) { this.field_184473_aH = this.motionY; if (!this.isRiding()) { if (onGroundIn) { if (this.fallDistance > 3.0F) { if (this.status != EntityColoredOakBoat.Status.ON_LAND) { this.fallDistance = 0.0F; return; } this.fall(this.fallDistance, 1.0F); if (!this.worldObj.isRemote && !this.isDead) { this.setDead(); if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) { for (int i = 0; i < 3; ++i) { this.entityDropItem(new ItemStack(Item.getItemFromBlock(MWColoredBlocks.colored_planks_oak), 1, this.getBoatType().getMetadata()), 0.0F); } for (int j = 0; j < 2; ++j) { this.dropItemWithOffset(Items.stick, 1, 0.0F); } } } } this.fallDistance = 0.0F; } else if (this.worldObj.getBlockState((new BlockPos(this)).down()).getMaterial() != Material.water && y < 0.0D) { this.fallDistance = (float)((double)this.fallDistance - y); } } } public boolean func_184457_a(int p_184457_1_) { return ((Boolean)this.dataWatcher.get(field_184468_e[p_184457_1_])).booleanValue() && this.getControllingPassenger() != null; } /** * Sets the damage taken from the last hit. */ public void setDamageTaken(float damageTaken) { this.dataWatcher.set(DAMAGE_TAKEN, Float.valueOf(damageTaken)); } /** * Gets the damage taken from the last hit. */ public float getDamageTaken() { return ((Float)this.dataWatcher.get(DAMAGE_TAKEN)).floatValue(); } /** * Sets the time to count down from since the last time entity was hit. */ public void setTimeSinceHit(int timeSinceHit) { this.dataWatcher.set(TIME_SINCE_HIT, Integer.valueOf(timeSinceHit)); } /** * Gets the time since the last hit. */ public int getTimeSinceHit() { return ((Integer)this.dataWatcher.get(TIME_SINCE_HIT)).intValue(); } /** * Sets the forward direction of the entity. */ public void setForwardDirection(int forwardDirection) { this.dataWatcher.set(FORWARD_DIRECTION, Integer.valueOf(forwardDirection)); } /** * Gets the forward direction of the entity. */ public int getForwardDirection() { return ((Integer)this.dataWatcher.get(FORWARD_DIRECTION)).intValue(); } public void setBoatType(EntityColoredOakBoat.Type boatType) { this.dataWatcher.set(BOAT_TYPE, Integer.valueOf(boatType.ordinal())); } public EntityColoredOakBoat.Type getBoatType() { return EntityColoredOakBoat.Type.byId(((Integer)this.dataWatcher.get(BOAT_TYPE)).intValue()); } protected boolean canFitPassenger(Entity passenger) { return this.getPassengers().size() < 2; } /** * For vehicles, the first passenger is generally considered the controller and "drives" the vehicle. For example, * Pigs, Horses, and Boats are generally "steered" by the controlling passenger. */ public Entity getControllingPassenger() { List<Entity> list = this.getPassengers(); return list.isEmpty() ? null : (Entity)list.get(0); } @SideOnly(Side.CLIENT) public void func_184442_a(boolean p_184442_1_, boolean p_184442_2_, boolean p_184442_3_, boolean p_184442_4_) { this.field_184480_az = p_184442_1_; this.field_184459_aA = p_184442_2_; this.field_184461_aB = p_184442_3_; this.field_184463_aC = p_184442_4_; } public static enum Status { IN_WATER, UNDER_WATER, UNDER_FLOWING_WATER, ON_LAND, IN_AIR; } public Item getItemBoat() { switch (this.getBoatType()) { case WHITE: return MWColoredBoats.colored_oak_boat_white; case ORANGE: return MWColoredBoats.colored_oak_boat_orange; case MAGENTA: return MWColoredBoats.colored_oak_boat_magenta; case LIGHT_BLUE: return MWColoredBoats.colored_oak_boat_light_blue; case YELLOW: return MWColoredBoats.colored_oak_boat_yellow; case LIME: return MWColoredBoats.colored_oak_boat_lime; case PINK: return MWColoredBoats.colored_oak_boat_pink; case GRAY: return MWColoredBoats.colored_oak_boat_gray; case SILVER: return MWColoredBoats.colored_oak_boat_silver; case CYAN: return MWColoredBoats.colored_oak_boat_cyan; case PURPLE: return MWColoredBoats.colored_oak_boat_purple; case BLUE: return MWColoredBoats.colored_oak_boat_blue; case BROWN: return MWColoredBoats.colored_oak_boat_brown; case GREEN: return MWColoredBoats.colored_oak_boat_green; case RED: return MWColoredBoats.colored_oak_boat_red; case BLACK: return MWColoredBoats.colored_oak_boat_black; default: return MWColoredBoats.colored_oak_boat_white; } } public static enum Type { WHITE(0, "white"), ORANGE(1, "orange"), MAGENTA(2, "magenta"), LIGHT_BLUE(3, "light_blue"), YELLOW(4, "yellow"), LIME(5, "lime"), PINK(6, "pink"), GRAY(7, "gray"), SILVER(8, "silver"), CYAN(9, "cyan"), PURPLE(10, "purple"), BLUE(11, "blue"), BROWN(12, "brown"), GREEN(13, "green"), RED(14, "red"), BLACK(15, "black"); private final String name; private final int metadata; private Type(int metadataIn, String nameIn) { this.name = nameIn; this.metadata = metadataIn; } public String getName() { return this.name; } public int getMetadata() { return this.metadata; } public String toString() { return this.name; } /** * Get a boat type by it's enum ordinal */ public static EntityColoredOakBoat.Type byId(int id) { if (id < 0 || id >= values().length) { id = 0; } return values()[id]; } public static EntityColoredOakBoat.Type getTypeFromString(String nameIn) { for (int i = 0; i < values().length; ++i) { if (values()[i].getName().equals(nameIn)) { return values()[i]; } } return values()[0]; } } } Since it's the exact copy of the vanilla boat class i don't understand why it doesn't move. Also is there a way to just let this class extends the vanilla class? Because if do extends EntityBoat and override the only methods for the type, i get this error on the getBoatType function The return type is incompatible with EntityBoat.getBoatType()
  25. I'm setting to Translucent because the block has a trasparent overlay texture, wich if i set it to Solid it won't be transparent
×
×
  • Create New...

Important Information

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