Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

caroke

Members
  • Joined

  • Last visited

Everything posted by caroke

  1. Thanks everyone for all tips, i now almost have the block i wanted but its enough for what i need to do.
  2. well thanks to your link, I can make a pressure plate texture but still doesnt work on my block I have try to create a new one who only extends Block and it work but i need to have same properties as pressure plate, i will keep trying some stuff and see if it want to work.
  3. I didnt know about setRegistryName and getRegistryName, i will use it thx I call registerRender in the client proxy is this wrong? My bad i send the wrong block code. This class is just a copy of BlockPressurePlate class: public class BlocClearInventory extends BlockBasePressurePlate { public static final PropertyBool POWERED = PropertyBool.create("powered"); private final BlocClearInventory.Sensitivity sensitivity; protected BlocClearInventory() { super(Material.wood); this.setDefaultState(this.blockState.getBaseState().withProperty(POWERED, Boolean.valueOf(false))); this.sensitivity = BlocClearInventory.Sensitivity.MOBS; setRegistryName("plate_clear_inventory"); setCreativeTab(BlockList.creativeTabBlock); register(); } protected int getRedstoneStrength(IBlockState state) { return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; } protected IBlockState setRedstoneStrength(IBlockState state, int strength) { return state.withProperty(POWERED, Boolean.valueOf(strength > 0)); } protected int computeRedstoneStrength(World worldIn, BlockPos pos) { AxisAlignedBB axisalignedbb = this.getSensitiveAABB(pos); List <? extends Entity > list; switch (this.sensitivity) { case EVERYTHING: list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb); break; case MOBS: list = worldIn.<Entity>getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); break; default: return 0; } if (!list.isEmpty()) { for (Entity entity : list) { if (!entity.doesEntityNotTriggerPressurePlate()) { return 15; } } } return 0; } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(POWERED, Boolean.valueOf(meta == 1)); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((Boolean)state.getValue(POWERED)).booleanValue() ? 1 : 0; } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {POWERED}); } public static enum Sensitivity { EVERYTHING, MOBS; } public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (!worldIn.isRemote) { int i = this.getRedstoneStrength(state); if (i == 0) { if(entityIn instanceof EntityPlayer){ ((EntityPlayer) entityIn).inventory.clear(); } this.updateState(worldIn, pos, state, i); } } } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return false; } public void register(){ GameRegistry.registerBlock(this,this.getRegistryName()); LanguageRegistry.addName(this, "Vide inventaire"); } public void registerRenders(){ Item item = Item.getItemFromBlock(this); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID+":"+item.getRegistryName(), "inventory")); } the other one was just a test. Here are the json file: blockstates: { "variants": { "normal": { "model": "mod:plate_clear_inventory"} } } models.block: { "parent": "block/pressure_plate", "textures": { "particle": "mod:blocks/plate_clear_inventory", "down":"mod:blocks/plate_clear_inventory", "up":"mod:blocks/plate_clear_inventory", "north":"mod:blocks/plate_clear_inventory", "east":"mod:blocks/plate_clear_inventory", "south":"mod:blocks/plate_clear_inventory", "west":"mod:blocks/plate_clear_inventory" } } models.item: { "parents": "mod:block/plate_clear_inventory", "elements": [ { "from": [ 1, 0, 1 ], "to": [ 15, 1, 15 ], "faces": { "down": { "uv": [ 1, 1, 15, 15 ], "texture": "mod:blocks/plate_clear_inventory", "cullface": "down" }, "up": { "uv": [ 1, 1, 15, 15 ], "texture": "mod:blocks/plate_clear_inventory" }, "north": { "uv": [ 1, 15, 15, 16 ], "texture": "mod:blocks/plate_clear_inventory" }, "south": { "uv": [ 1, 15, 15, 16 ], "texture": "mod:blocks/plate_clear_inventory" }, "west": { "uv": [ 1, 15, 15, 16 ], "texture": "mod:blocks/plate_clear_inventory" }, "east": { "uv": [ 1, 15, 15, 16 ], "texture": "mod:blocks/plate_clear_inventory" } } } ] } Right now, there is no render in game. i think my json file are wrong but i cant find any example even in minecraft file, i can't understand how they did it. plate_clear_inventory.png is just a 16*16 image. here are some error when i launch the game: [09:39:14] [Client thread/ERROR] [FML]: Model definition for location mod:plate_clear_inventory#powered=false not found [09:39:14] [Client thread/ERROR] [FML]: Model definition for location mod:plate_clear_inventory#powered=true not found
  4. Hello, i need your help again, I have made a custom pressure plate but i dont know how to add a render and i can't find anything that could help me. Here is my class: public class BlockClearInventory extends BlockPressurePlate { public static final PropertyBool POWERED = PropertyBool.create("powered"); private final BlocClearInventory.Sensitivity sensitivity; protected BlockClearInventory() { super(Material.wood,BlockPressurePlate.Sensitivity.MOBS); this.setDefaultState(this.blockState.getBaseState().withProperty(POWERED, Boolean.valueOf(false))); this.sensitivity = BlockClearInventory.Sensitivity.MOBS; setUnlocalizedName("plate_clear_inventory"); setCreativeTab(BlockList.creativeTabBlock); GameRegistry.registerBlock(this,this.getUnlocalizedName().substring(5)); LanguageRegistry.addName(this, "Vide inventaire"); } public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (!worldIn.isRemote) { int i = this.getRedstoneStrength(state); if (i == 0) { if(entityIn instanceof EntityPlayer){ ((EntityPlayer) entityIn).inventory.clear(); } this.updateState(worldIn, pos, state, i); } } } public void registerRenders(){ Item item = Item.getItemFromBlock(this); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID + ":"+item.getUnlocalizedName().substring(5), "inventory")); } } I also have the 3 json file in the right assets. So if someone could give me some tips because i'm stuck right now, i would appreciate it. Sorry about my english
  5. Hello, i need your help again, I have made a custom pressure plate but i dont know how to add a render and i can't find anything that could help me. Here is my class: public class BlockClearInventory extends BlockPressurePlate { public static final PropertyBool POWERED = PropertyBool.create("powered"); private final BlocClearInventory.Sensitivity sensitivity; protected BlockClearInventory() { super(Material.wood,BlockPressurePlate.Sensitivity.MOBS); this.setDefaultState(this.blockState.getBaseState().withProperty(POWERED, Boolean.valueOf(false))); this.sensitivity = BlockClearInventory.Sensitivity.MOBS; setUnlocalizedName("plate_clear_inventory"); setCreativeTab(BlockList.creativeTabBlock); GameRegistry.registerBlock(this,this.getUnlocalizedName().substring(5)); LanguageRegistry.addName(this, "Vide inventaire"); } public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (!worldIn.isRemote) { int i = this.getRedstoneStrength(state); if (i == 0) { if(entityIn instanceof EntityPlayer){ ((EntityPlayer) entityIn).inventory.clear(); } this.updateState(worldIn, pos, state, i); } } } public void registerRenders(){ Item item = Item.getItemFromBlock(this); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID + ":"+item.getUnlocalizedName().substring(5), "inventory")); } } I also have the 3 json file in the right assets. So if someone could give me some tips because i'm stuck right now, i would appreciate it. Sorry about my english
  6. Thanks for the fast answer, so in my gui i have to send the package and where i need to grab the TileEntity ?
  7. Hello, i made a custom block with his own tile entity. So when i place it, i open a gui where i can write a string and add it to the tile entity. But the Tile Entity is different from the one i create when i place the block, so it add the string but to a wrong tile entity. Here is what i got after some print in eclipse: [17:07:30] [Client thread/INFO] [sTDOUT]: [com.kidscode.kidscode.gui.GuiScreenBlockText:actionPerformed:82]: com.kidscode.kidscode.tileEntity.TileEntityTextChat@96fc177 [17:07:33] [server thread/INFO] [sTDOUT]: [com.kidscode.kidscode.block.BlockTextChat:onNeighborBlockChange:61]: com.kidscode.kidscode.tileEntity.TileEntityTextChat@7d681d0b Looks like there is 2 entity for the same block pos, one for the server and the other one for the client. I dont know how to resolve it

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.