-
Posts
101 -
Joined
-
Last visited
-
Days Won
1
Everything posted by hiotewdew
-
Try looking at getStateForPlacement in BlockStairs. It gets the neighbor's blockstate and then uses withProperty to adjust the current one to match the others.
-
Override neighborChanged and modify the blockstate based on the neighbor blockstate, and then go in your blockstate JSON (in your assets) and add a model for the state you made.
-
Threads don't get "closed" really, just edit the title and add [SOLVED] just fyi
-
Currently trying to redo my armor to fix this bug: https://github.com/itsmeow/betteranimalsplus/issues/31 But the texturemap isn't fitting on the actual 3d piece. I've got the item here: https://github.com/itsmeow/betteranimalsplus/blob/master/src/main/java/its_meow/betteranimalsplus/common/item/ItemHirschgeistSkullWearable.java with the texture defined inside. I've got the model here https://github.com/itsmeow/betteranimalsplus/blob/master/src/main/java/its_meow/betteranimalsplus/client/model/ModelHirschgeistHelmet.java (SkullArmorPiece in the same folder is our old one) And yet, the armor texture is still not fitting (and I think the bug still persists, any reason why it happens in the first place)? I've currently got the raw texturemap as the layer 1 and the real texture as layer 2 and it just doesn't fit See here for textures: https://github.com/itsmeow/betteranimalsplus/tree/master/src/main/resources/assets/betteranimalsplus/textures/models/armor Also, I think the original bug was because the head itself wasn't a child of bipedHead, but copied its rotation values and something about that is weird in the inventory renderer. But I'm still not sure because I've seen it like once with the new one. Also, the original bug does not ALWAYS happen in the inventory but instead when the player is at some specific rotations. By "not fit" I mean it's completely off (and I can't pinpoint the texture position, it seems to be jumbled all around) Basically: Why doesn't the texture fit? Is there a proper fix to this backwards inventory bug? How should the texture/model be exported from Tabula to make it correct?
-
Figured it out. The first issue was in the onBlockHarvested method, I did a super call to BlockSkull.onBlockHarvested, causing 1/2 of the extra drops. The second issue was from the Block.harvestBlock method, which also calls a drop of the item as well as some stat collection. I override harvestBlock and removed the dropping code but kept the stats/hunger part. Also, since my onBlockHarvested was identical to BlockSkull's, I removed the override and let BlockSkull handle it. Now it drops as expected.
-
[1.12.2]How to send command when player join a game?
hiotewdew replied to mlgmxyysd's topic in Modder Support
Not to go too off topic, but /login can be used on servers as a staff security measure as well as for cracked server auth. So, it's not always malicious. I once had to use it on my online mode server because we had this hacker who somehow figured out that commands could be run by staff before they were authenticated (I have no idea how, but I'm not lying, he'd done it) and so I had to add a login command for staff to counteract it. -
I've got a class that overrides BlockSkull and I want it to drop the right item when it's broken, and I've overriden onBlockHarvested, getItemDropped, and getDrops, and in creative mode it works as expected (no drop unless broken by water/other sources) but in survival it drops 3x unless broken by water/other sources. Here's my class: package its_meow.betteranimalsplus.common.block; import java.util.Random; import its_meow.betteranimalsplus.BetterAnimalsPlusMod; import net.minecraft.block.BlockSkull; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockAnimalSkull extends BlockSkull implements ITileEntityProvider { public BlockAnimalSkull() { this.setHardness(1.0F); this.setSoundType(SoundType.STONE); this.translucent = true; this.fullBlock = false; this.setCreativeTab(BetterAnimalsPlusMod.tab); } /** * Called before the Block is set to air in the world. Called regardless of if the player's tool can actually * collect this block */ @Override public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { if (player.capabilities.isCreativeMode) { state = state.withProperty(NODROP, Boolean.valueOf(true)); worldIn.setBlockState(pos, state, 4); } this.dropBlockAsItem(worldIn, pos, state, 0); super.onBlockHarvested(worldIn, pos, state, player); } @Override public boolean hasTileEntity() { return true; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isTopSolid(IBlockState state) { return false; } @Override public boolean canDispenserPlace(World world, BlockPos pos, ItemStack stack) { return false; } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.INVISIBLE; } @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(this.getItemBlock(), 1); } @Override public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(this.getItemBlock(), 1); } @Override public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { if (!((Boolean)state.getValue(NODROP)).booleanValue()) { Random rand = world instanceof World ? ((World)world).rand : RANDOM; Item item = this.getItemDropped(state, rand, fortune); if (item != Items.AIR) { drops.add(new ItemStack(item, 1)); } } } /** * Get the Item that this Block should drop when harvested. */ @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return this.getItemBlock(); } public ItemBlock getItemBlock() { return null; } } Don't worry, my actual implementations override getItemBlock(), so it doesn't pass null. This is a generic class.
-
Figured it out. My get method uses both getMapStorage and getPerWorldStorage. public static ClaimSerializer get(World world) { // PER WORLD STORAGE ClaimSerializer save = (ClaimSerializer) world.getPerWorldStorage().getOrLoadData(ClaimSerializer.class, DATA_NAME); if(save == null) { save = new ClaimSerializer(); // MAP STORAGE! world.getMapStorage().setData(DATA_NAME, save); } return save; }
-
I'm working on a claim system mod, and I'm using WorldSavedData to serialize the claims, including UUIDs of owners/members. However, I've run into an issue. When the data is saved, it saves with the proper UUID, confirmed by NBTExplorer. However upon loading the data, if I use UUIDs instead of strings I get 000000-00000-0000 as my UUID and if I use strings and parse it into a UUID, I get an invalid string that causes a crash. (Presumably empty string or 00000-000-000) See comment below. The integer array loads properly and I've ensured everything is serverside. Another issue I've run into is that the data from the nether isn't saved. There's no dat file, even though I am using perWorldStorage. Here's how my serializer works. It starts in my event handler, which has the following events: @SubscribeEvent public void onWorldLoad(WorldEvent.Load e) { if(!e.getWorld().isRemote) { ClaimManager.getManager().deserialize(e.getWorld()); } } @SubscribeEvent public void onWorldSave(WorldEvent.Save e) { if(!e.getWorld().isRemote) { ClaimManager.getManager().serialize(e.getWorld()); } } Which both of the following fire properly and go to my ClaimManager (responsible for adding and removing claims from the official claims list) These two methods are the beef of the bunch: This is my actual WorldSavedData (ClaimSerializer): public class ClaimSerializer extends WorldSavedData { private static final String DATA_NAME = Ref.MOD_ID + "_ClaimsData"; public NBTTagCompound data = new NBTTagCompound(); public ClaimSerializer() { super(DATA_NAME); } public ClaimSerializer(String s) { super(s); } @Override public void readFromNBT(NBTTagCompound nbt) { data = nbt; } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound = data; return compound; } public static ClaimSerializer get(World world) { ClaimSerializer save = (ClaimSerializer) world.getPerWorldStorage().getOrLoadData(ClaimSerializer.class, DATA_NAME); if(save == null) { save = new ClaimSerializer(); world.getMapStorage().setData(DATA_NAME, save); } return save; } } As you can see, it uses getPerWorldStorage, and is provided the world instance from the original event to return a storage, but for some reason nothing is saved to the nether. I've tested this on both a server and singleplayer. It always loads as an empty UUID and doesn't save nether info. The UUID issue only happens when the game is exited and started. Any ideas? For more context, my source: https://github.com/itsmeow/ClaimIt/tree/master/src/main/java/its_meow/claimit
-
[SOLVED] Serverside giving the wrong results
hiotewdew replied to hiotewdew's topic in Modder Support
Don't mean to necro, but it turns out all I had to do was put and if(!world.isRemote) {} check in general. -
I'm currently updating Colored Chests and I've come across an issue. I'm using a single Block class to create multiple block instances with different colors. As in, I pass a color and a color name inside the initializer to the block, and register the new block class as it's own block with a custom registry name (appending the color name I gave it to "coloredchest"). However, upon restarting the world, the console prints "Registry Block: Found a missing id from the world coloredchests:coloredchest" and the blocks are gone. But I never register a block with that ID, they all have colors after the name. My Block registry: https://github.com/itsmeow/ColoredChests/blob/master/src/main/java/its_meow/coloredchests/BlockRegistry.java Block itself: https://github.com/itsmeow/ColoredChests/blob/master/src/main/java/its_meow/coloredchests/chest/BlockColoredChest.java I can tell it's something to do with the way I'm doing the registration, but I really do not have the time to redo this. I know there's millions of better ways I could do it, but I'm looking for the easy solution. Is there something that can fix the way I'm doing it? If there's not one, perhaps an easier/equivically difficult way to create the blocks with SEPERATE IDs! Because of the way they're considered seperate blocks, I don't have to check if the colors match inside the block class with other chests, only if they are the same block.
-
[SOLVED] Serverside giving the wrong results
hiotewdew replied to hiotewdew's topic in Modder Support
Did you test this on a singleplayer world? -
[SOLVED] onItemStoppedBeingHeld event with ItemStack parameter?
hiotewdew replied to hiotewdew's topic in Modder Support
Is there a way that doesn't involve checking every tick? -
I'm making a land claiming mod, and when using the claim tool it checks for overlaps. I got all the overlapping code down and it works fine, but the server thread returns that the block overlaps a claim even if there are NO CLAIMS in the world, and the main thread returns the proper result. See the line commented where it prints "overlaps". The server is completely off for no apparent reason. @Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); NBTTagCompound data = stack.getTagCompound(); if(data == null) { NBTTagCompound newTag = new NBTTagCompound(); data = newTag; stack.setTagCompound(newTag); } boolean isInClaim = ClaimManager.getManager().isBlockInAnyClaim(pos, worldIn); System.out.println("Overlaps: " + isInClaim); // THIS IS THE LINE WHERE THE SERVER THREAD IS WRONG if(!isInClaim) { int[] posArray = {pos.getX(), pos.getZ()}; if(data.hasKey("Corner1")) { if(!worldIn.isRemote) player.sendMessage(new TextComponentString("Added corner 2 at " + posArray[0] + ", " + posArray[1])); int[] corner1 = data.getIntArray("Corner1"); int[] corner2 = posArray; BlockPos c1 = new BlockPos(corner1[0], 0, corner1[1]); BlockPos c2 = new BlockPos(corner2[0], 0, corner2[1]); /* Not needed due to ClaimArea constructor if(c1.subtract(c2).getX() < 0 && c1.subtract(c2).getY() < 0) { BlockPos c = c1; // Swap values to make c1 the proper corner c1 = c2; c2 = c; }*/ BlockPos sideL = c2.subtract(c1); // Subtract to get side lengths // Claim corners are automatically corrected to proper values by constructor ClaimArea newClaim; newClaim = new ClaimArea(player.dimension, c1.getX(), c1.getZ(), sideL.getX(), sideL.getZ(), player); boolean didClaim = ClaimManager.getManager().addClaim(newClaim); // Add claim if(!worldIn.isRemote) player.sendMessage(new TextComponentString(didClaim ? "Claim added successfully!" : "This claim overlaps another claim!")); // Remove data so a new claim can be made. data.removeTag("Corner1"); return didClaim ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; } else { data.setIntArray("Corner1", posArray); if(!worldIn.isRemote) player.sendMessage(new TextComponentString("Added corner 1 at " + posArray[0] + ", " + posArray[1])); } return EnumActionResult.SUCCESS; } else { if(!worldIn.isRemote) { data.removeTag("Corner1"); player.sendMessage(new TextComponentString("You cannot set a corner inside an existing claim!")); } } return EnumActionResult.FAIL; } I know this is not nearly enough code to represent the problem, so here is my source I'm not sure how I should be doing the checking to insure that the server does all the work, and the client recieves such, but also having it work properly on SP. This error shows up on SP, I haven't tested on an actual server.
-
I'm looking for a method I can override in the item class to detect when the item is moved, dropped, or not being held by the player anymore. I know onItemDropped exists, but I need one for when it is not being held anymore. Does such a method exist? It also needs itemstack as a parameter (or player and hand)
-
[SOLVED] [1.12.2] High spawnrates in some modded biomes
hiotewdew replied to hiotewdew's topic in Modder Support
Alright so some of my mobs just straight up aren't spawning: Bear (all 3, although kermode is rare) Deer (Don't know why, 13 weight is high for creatures) Feral Wolves Fox Tarantula (Went to desert at night) Hirschgeist (1% spawnrate, not worried abt it) Mob registry: https://github.com/itsmeow/betteranimalsplus/blob/master/src/main/java/its_meow/betteranimalsplus/init/MobRegistry.java Any ideas? I'll be busy for the rest of the day so I'll check back tonight -
[SOLVED] [1.12.2] High spawnrates in some modded biomes
hiotewdew replied to hiotewdew's topic in Modder Support
Figured it out. I have two registry functions and I forgot to put modEntities++ on the other. *facepalm* -
[SOLVED] [1.12.2] High spawnrates in some modded biomes
hiotewdew replied to hiotewdew's topic in Modder Support
It seems as if one entity is overwriting all the other entity's renderers when the game starts. -
[SOLVED] [1.12.2] High spawnrates in some modded biomes
hiotewdew replied to hiotewdew's topic in Modder Support
New bug: naturally spawned coyotes/bears have a bear model? It's a bear. That is named coyote, has coyote ai, but has a bear model. Why? I have no idea. -------------SNIP I thought a spawn egg made it work fine, but no, deers are now brown bears. HELP!