Jump to content

JTK222

Members
  • Posts

    73
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by JTK222

  1. At least it looks like that: (Updated the right version cause I though the problem could be caused by a failed update.
  2. Hey while working on 2 different mods at one time I noticed that I have in one of my Workspaces following methods: ItemStack.setCount(int size) ItemStack.grow(int quantity) ItemStack.shrink(int quantity) but not in my other workspace whats strange as booth have the same versions. Wanted just to ask if somebody has an Idea what could have caused this.
  3. Hey guys, I am working a custom Entity that has an Inventory like Horses do. Everything is working fine Server Side but the Inventory doesn't exists on the Client Side. I have already looked at the Horse code but it's all just hard to understand as the Horse refers to a Method hardcoded into the player where I also couldn't find any Synchronization Methods. I would appreciate every help and thanks in advance!
  4. Well you can never stop learning .... Thank you, and I Though I have looked at all the classes that do the model stuff Ingame.
  5. I had an Idea of a complex Item the problem is it would have 2^1536 different combinations whats currently impossible (at least I Couldn't find a way to make it without creating multiple items). I think this could be solved with an additional map and register method in the ItemModelMesher class, with which we could register Items that have an advanced Model that might also be created during Runtime (using NBT?). My Idea was that an event gets called when the game asks for the Model for rendering,which could be used to manipulate/replace that model. This addition might be useful for a bunch of Mods (Tinkers Construct,.... well don't know any other mods with so extremly dynamic items or at least don't know their names). But also for mods that might want to display anything on the Item Model itself instead of an Lore or something (Power Level?)
  6. Oh dude I am feeling so stupid ... I just forgot to Initialize the Inventory in the Default implementation.... That was also why I haven't understand it because I haven't seen any problems in the code *facepalm* but thank you for your help ^^
  7. Hey guys, trying now for 3 days to somehow port my IEEP to the new Capabilities system the Problem is I have never understood how that IEEP stuff was working at least not completely. And now I don't want simply to port it but I want to understand also what I am doing.... the problem with this is I cannot find any good explained examples that also add inventory's. I have already tried first to copy some code and try to figure it out by myself and it has been working and I am now understanding the default Capabilities without any Storage. The Problem is that I am still not understanding how to make any Storage I would be very happy about any help my current ported code can be found here: https://github.com/DarkRoleplay/1.9-Dark-Roleplay-Core/tree/master/src/main/java/net/drpcore/common/entities/player (Yes the Capabilitie Injection has been made in the Main class) Oh and sorry for the messy structure I want first to learn that before cleaning it up Thanks in advance - JTK222
  8. Oh man its so easy and I had so much Trouble with it *facepalm* Big thx haven't known that this is existing: ByteBufUtils.writeUTF8String(buf, category); Makes a lot easier ^^ Big thanks - JTK222
  9. To say the truth I am not really understanding how the bytebuffer stuff is working my English isn't very good and that creates the problem that googling explanations isn't the easiest thing when you don't know which words to use. I have managed to write this Code after a few hours of google and maybe a few more hours of trial and error. How could I read the Inserted Variables separately? A Link to a good explaining tutorial would be a big help.
  10. private int recipeID; private Block craftingStation; private int stationID; private String category; public PacketCraft(){} public PacketCraft(Block craftingStation,String Category, int recipeID){ this.recipeID = recipeID; this.stationID = Block.getIdFromBlock(craftingStation); this.category = Category; } @Override public void fromBytes(ByteBuf buf) { String[] temp = new String(Arrays.copyOfRange(buf.array(),1,buf.array().length)).split(";"); recipeID = Integer.parseInt(temp[0]); stationID = Integer.parseInt(temp[1]); category = temp[2]; } @Override public void toBytes(ByteBuf buf) { String temp = String.valueOf(recipeID) + ";" + String.valueOf(stationID) + ";" + category; buf.writeBytes(temp.getBytes()); } @Override public void handleClientSide(PacketCraft message, EntityPlayer player) {} @Override public void handleServerSide(PacketCraft message, EntityPlayer player) { CraftingManager.craftItem(message.stationID,message.category,message.recipeID,player); } Here it is. Haven't though that it might be important as I though its something more related to String in general
  11. Hey guys, I have a problem with some strings after I send them from the Client to the server. I need to split the string and after I split it the formatting is different then it is server side. argh... long text short Question printf outputs me the following Strings: @Potato @Potato@ The first one is the output after I receive it with the server and Split it. The Problem is I need it to get a value out of a HashMap can anybody help me? And maybe explain me for what kind of formatting "@" stands for? Thanks in advance - JTK222
  12. Big thanks ^^ I have already though that I need to export it in a different way than build. But I wasn't able to find it (maybe because my English isn't good enough ) I am using a fresh Install of the Forge workspace for both mods so both are exactly the same. But also thx for your suggestion with the MCP mapping could help me in the Future ^^
  13. Hey, I am trying since a few days to implement a Coremod I Made for my mods into the workspace but it crashes every time I Press a Key (because of a Keyhandler its saying that the .isKeyDown Method isn't existing) But it is working outside of development environments. I have tried to add it into the Mods folder, and I have also tried to add it into the Java Build Path of the project. Thanks in advance for any help. Crashlog: http://hastebin.com/ofoqimosig.dos
  14. *facepalm* why do I always only fail with the basic stuff.... And for the 3 setDefaultBlockstates I said that it's not done yet But that still doesn't solve the problem that I can't change the state....
  15. Here is the Block which can't place event Vanilla blocks: import net.jtk.darkroleplay.blocks.ShipSteeringWheel.ShipSteeringWheel; import net.jtk.darkroleplay.blocks.ShipSteeringWheel.TileEntityCustomShipSteeringWheel; import net.jtk.darkroleplay.main.DarkRoleplayTabs; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class WallTorchEmpty extends BlockContainer{ public static Block blockWallTorchEmpty; public static Object instance; public static PropertyInteger DIR = PropertyInteger.create("dir", 0, 3); public static PropertyBool AddonLighter = PropertyBool.create("addonLighter"); public static PropertyBool AddonTrap = PropertyBool.create("addonTrap"); public WallTorchEmpty() { super(Material.wood); this.setDefaultState(this.blockState.getBaseState().withProperty(DIR, Integer.valueOf(0))); this.setDefaultState(this.blockState.getBaseState().withProperty(AddonLighter, false)); this.setDefaultState(this.blockState.getBaseState().withProperty(AddonTrap, false)); } static { blockWallTorchEmpty = new WallTorchEmpty().setHardness(2.0F) .setResistance(10.0F).setLightLevel(0.0F) .setUnlocalizedName("blockWallTorchEmpty") .setStepSound(Block.soundTypeWood) .setCreativeTab(DarkRoleplayTabs.drBlocksTab); blockWallTorchEmpty.setBlockBounds(1.0F / 16F * 0F, 0.0F, 1.0F / 16F * 0F, 1.0F / 16F * 16F, 1.0F / 16F * 2F, 1.0F / 16F * 16F); } public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){ IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this){ if (iblockstate.getValue(DIR).equals(1)) { this.setBlockBounds(0.0F, 0.2F, 0.375F, 0.25F, 0.8F, 0.625F); } else if(iblockstate.getValue(DIR).equals(2)) { this.setBlockBounds(0.375F, 0.2F, 0.0F,0.625F, 0.8F, 0.25F); } else if(iblockstate.getValue(DIR).equals(3)) { this.setBlockBounds(0.75F, 0.2F, 0.375F, 1.0F, 0.8F, 0.625F); } else { this.setBlockBounds(0.375F, 0.2F, 0.75F, 0.625F, 0.8F, 1.0F); } } } public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(DIR, Integer.valueOf(meta)); } public int getMetaFromState(IBlockState state) { return ((Integer)state.getValue(DIR)).intValue(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {DIR,AddonLighter,AddonTrap}); } @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack){ EntityPlayer entity = (EntityPlayer) placer; if(entity!=null){int i = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; world.setBlockState(pos, state.withProperty(DIR, Integer.valueOf(i)), 3); } world.markBlockForUpdate(pos); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { if(playerIn.getHeldItem() != null){ if(playerIn.getHeldItem().getItem().equals(Blocks.torch)){ //worldIn.setBlockState(pos, WallTorchLit.blockWallTorchLit.getDefaultState()/*.withProperty(DIR, state.getValue(DIR)).withProperty(AddonLighter, state.getValue(AddonLighter)).withProperty(AddonTrap, state.getValue(AddonTrap))*/,2); worldIn.setBlockState(pos, Blocks.stone.getDefaultState()); worldIn.markBlockForUpdate(pos); } } return true; } } public int getRenderType() { return -1; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityCustomWallTorchEmpty(); } @Override public boolean isFullCube() { return false; } public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); } } And could it be something with the TileEntity? Or because its a BlockContainer? Because I can place a normal Block out of my mod: public class blockPlaceholder extends Block{ public static Block blockPlaceholder; public static Object instance; public blockPlaceholder(){ super(Material.piston); } static{ blockPlaceholder = (blockPlaceholder) (new blockPlaceholder() .setUnlocalizedName("blockPlaceholder") .setLightLevel(1F/15F*14.0F) .setCreativeTab(DarkRoleplayTabs.drBlocksTab) .setHardness(2.0F) .setStepSound(Block.soundTypePiston) .setResistance(10.0F)); blockPlaceholder.setHarvestLevel("pickaxe", 0); blockPlaceholder.setBlockBounds(0.0F,0.0F,0.0F,1.0F,1.0F,1.0F); }
  16. Could this cause this problem? If not I would keep it because I like it to have everything from block in one Class or at least in one package. It should, it's the same as in the Minecraft Vanilla code but a little bit simpler to understand and with more data. (Vanilla store for default just the facing and the Powered Boolean) Figured out that they are working but not from every block for example they aren't working from my unlit variant of this block. Could make a Video but could take some time.
  17. Remove some stuff like setBlockBoundsOnState public class WallTorchLit extends BlockContainer{ public static Block blockWallTorchLit; public static Object instance; public static final PropertyInteger DIR = PropertyInteger.create("dir", 0, 3); public static final PropertyBool AddonLighter = PropertyBool.create("addonLighter"); public static final PropertyBool AddonTrap = PropertyBool.create("addonTrap"); public static final PropertyBool POWERED = PropertyBool.create("powered"); public WallTorchLit() { super(Material.wood); this.setDefaultState(this.blockState.getBaseState().withProperty(DIR, Integer.valueOf(0)).withProperty(AddonLighter, Boolean.valueOf(false)).withProperty(AddonTrap, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(true))); } static { blockWallTorchLit = new WallTorchLit().setHardness(2.0F) .setResistance(10.0F).setLightLevel(0.0F) .setUnlocalizedName("blockWallTorchLit") .setStepSound(Block.soundTypeWood) .setCreativeTab(DarkRoleplayTabs.drBlocksTab); blockWallTorchLit.setBlockBounds(1.0F / 16F * 0F, 0.0F, 1.0F / 16F * 0F, 1.0F / 16F * 16F, 1.0F / 16F * 2F, 1.0F / 16F * 16F); } public IBlockState getStateFromMeta(int meta) { int i = meta; if(i < 4){ return this.getDefaultState().withProperty(DIR, Integer.valueOf(meta)); }else if(i >= 4 && i < { return this.getDefaultState().withProperty(DIR, Integer.valueOf(meta-4)).withProperty(AddonLighter, true); }else if(i >= 8 && i < 12){ return this.getDefaultState().withProperty(DIR, Integer.valueOf(meta-).withProperty(AddonTrap,true); }else if(i >= 12 && i < 16){ return this.getDefaultState().withProperty(DIR, Integer.valueOf(meta-12)).withProperty(AddonTrap,true).withProperty(POWERED, true); } return this.getDefaultState().withProperty(DIR, Integer.valueOf(meta)); } public int getMetaFromState(IBlockState state) { int i = (Integer) state.getValue(DIR); if((Boolean) state.getValue(AddonLighter)) { i = i + 4; }else if((Boolean) state.getValue(AddonTrap)){ i = i + 8; if((Boolean) state.getValue(POWERED)){ i = i +4; } } return i; } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {DIR,AddonLighter,AddonTrap,POWERED}); } @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack){ EntityPlayer entity = (EntityPlayer) placer; if(entity!=null){int i = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; world.setBlockState(pos, state.withProperty(DIR, Integer.valueOf(i)), 3); } world.markBlockForUpdate(pos); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (((Boolean)state.getValue(POWERED)).booleanValue()) { return true; } else if(!worldIn.isRemote) { worldIn.setBlockState(pos, worldIn.getBlockState(pos).withProperty(POWERED, Boolean.valueOf(true)),2); worldIn.markBlockForUpdate(pos); //worldIn.scheduleUpdate(pos, this, 60); worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, ((Boolean)state.getValue(POWERED)).booleanValue() ? 0.6F : 0.5F); return true; } return true; } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if(worldIn.isRemote) { } else { worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false)), 3); worldIn.notifyNeighborsOfStateChange(pos, this); } } public int isProvidingWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) { return !((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; } public int isProvidingStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) { EnumFacing Facing = EnumFacing.SOUTH; switch((Integer)state.getValue(DIR)){ case 0: Facing = EnumFacing.NORTH; break; case 1: Facing = EnumFacing.EAST; break; case 2: Facing = EnumFacing.SOUTH; break; case 3: Facing = EnumFacing.WEST; break; default: break; } return ((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (Facing == side ? 15 : 0); } public boolean canProvidePower() { return true; } public int getRenderType() { return -1; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityCustomWallTorchLit(); } @Override public boolean isFullCube() { return false; } public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); } } The Block is still not Done but I can't place any Blocks Vanilla blocks are also not working...
  18. Hey guys I have searched already a few forum topics but none helped me. Here is my Code and the BlockState just don't changes. public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (((Boolean)state.getValue(POWERED)).booleanValue()) { return true; } else if(!worldIn.isRemote) { worldIn.setBlockState(pos, worldIn.getBlockState(pos).withProperty(POWERED, Boolean.valueOf(true)),2); worldIn.markBlockForUpdate(pos); //worldIn.scheduleUpdate(pos, this, 60); worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, ((Boolean)state.getValue(POWERED)).booleanValue() ? 0.6F : 0.5F); return true; } return true; } Thanks in Advance
  19. Thx @jabelar I haven't known Source tree yet it's much simpler with it ^^ I will give Github a second chance
  20. He is new to Forge and doesn't know any of the methods and he will need to make complex stuff from the beginning so it would be nice when I could just switch to the class he is currently working in and help him/explain something.
  21. The Problem is we cannot code together (at the same time) in one class using Github
  22. Hey, I am not sure if that's the right section but I have a question and wasn't able to find anything on google for that so... I wan't to ask if there is a way to code together on mode so that all files are live updated everyone can build and test it and we can work together on one file at the same Time. I Know already Saros can be used for this but I am not sure if its working with Forge I have used it only for Plugins. But If anybody knows if its possible with saros could you explain it to me? Thanks in Advance
×
×
  • Create New...

Important Information

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