Jump to content

FuzzyAcornIndustries

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by FuzzyAcornIndustries

  1. Should I just try to change my Creative Tab item listing to suppress listing the Crop Block and just go with it generating an item block for it?
  2. Hello, thank you for reading! I am working with a custom crop that functions similar to potatoes in terms of drops. With what I have right now, when I run DataGen I get an error that says: java.lang.IllegalStateException: Created block loot tables for non-blocks: [pokemonmd:blocks/oranian_berry_crop] This seems to be a related to how I register my crop block here https://github.com/SpikybumJolteon/PokemonMD-1.20.1/blob/master/src/main/java/net/spikybumjolteon/pokemonmd/common/core/ModBlocks.java private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<? extends T> sup) { return BLOCKS.register(name, sup); } public static final RegistryObject<Block> ORANIAN_BERRY_CROP = registerNoItem("oranian_berry_crop", () -> new OranianBerryCropBlock(BlockBehaviour.Properties.copy(Blocks.POTATOES).noOcclusion().noCollission())); When I switch registration to this function, DataGen works just fine but it creates the block in Creative Mode Tab: private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup) { return register(name, sup, ModBlocks::itemDefault); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator) { RegistryObject<T> ret = registerNoItem(name, sup); ITEMS.register(name, itemCreator.apply(ret)); return ret; } Here is the Loot Table DataGen I have https://github.com/SpikybumJolteon/PokemonMD-1.20.1/blob/master/src/main/java/net/spikybumjolteon/pokemonmd/datagen/ModLootTableProvider.java LootItemCondition.Builder lootitemcondition$builder = LootItemBlockStatePropertyCondition .hasBlockStateProperties(ModBlocks.ORANIAN_BERRY_CROP.get()) .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(OranianBerryCropBlock.AGE, OranianBerryCropBlock.MAX_AGE)); this.add(ModBlocks.ORANIAN_BERRY_CROP.get(), this.applyExplosionDecay(ModBlocks.ORANIAN_BERRY_CROP.get(), LootTable.lootTable().withPool(LootPool.lootPool() .add(LootItem.lootTableItem(ModItems.ORANIAN_BERRY.get()))) .withPool(LootPool.lootPool().when(lootitemcondition$builder) .add(LootItem.lootTableItem(ModItems.ORANIAN_BERRY.get()) .apply(ApplyBonusCount.addBonusBinomialDistributionCount(Enchantments.BLOCK_FORTUNE, 0.5714286F, 3)))) .withPool(LootPool.lootPool().when(lootitemcondition$builder).add(LootItem.lootTableItem(ModItems.REVIVE_SEED.get()) .when(LootItemRandomChanceCondition.randomChance(0.9F)))))); What is the proper way to register the Crop Block so the DataGen Loot Table will run while still omitting the block from Creative Tab? Apologies in advance if I am doing something wrong with this post or with Github, as I am very new to Github and only just returned to programming after 2 years since 1.15.
  3. I’m still trying to finalize my modification’s update from 1.12 to 1.15 so then I can finally update to the most current version; Apologies in advance for asking this of such an old version. I’m trying to find the proper way to do mob spawns via the biome dictionary in 1.15. What I have so far works with overworld spawns but it doesn’t work with Nether or with other biome mods like Biomes’o’plenty. Can I be given a proper direction to look at over how to do it correctly? What I have now was built from 1.12 era logic so probably not even worth showing.
  4. Oooh, thanks for clearing that up. Thanks, I definitely understand that is not something to try and do.
  5. I created a furnace like TileEntity that performs its own unique processes with its unique recipes. It performs exactly as intended with item processing and GUI display. At this point I want to add this Custom Furnace and its recipes to be viewed like a Furnace in the Recipe Book. What can I look at to figure out how to do this?
  6. Oh thanks! This is very helpful and I played around with all of these and have a good idea of how the three events work. Now how do you actually store information to be used on a different event? I think my needs changed a little bit. One of my users recommends that I only have specific items come back with the player rather than the whole inventory. So how could I do this: First event: Find a specific item in inventory on death Second event: Delete that specific item from drop collection Third event: Place that specific item in player inventory As far as I could tell from testing, in the Clone event, the getOriginal() does not have a record of the player inventory.
  7. I am looking to create an item where if it is in the player's main inventory, when the player dies, they do not drop their items upon death. What would I look into to create this effect? Item being consumed on use could be useful but not required.
  8. I want to figure out how potions in crafting recipes are handled. I see a TippedArrowRecipe class for I assume doing this with Tipped Arrows. If this is what needs to be used, how do I deploy this in my mod? (such as registering it and making the Json recipe files) I would not mind referral to another mod that has done this so I could reference for doing/learning this.
  9. Thank you! I knew it was something absolutely simple. I just didn't think to check the horse constructor.
  10. I'm working on a custom mount. Right now, I have it mimic most everything a horse can but I cannot figure out how to get the mount to travel up one block inclines like a horse can. I cannot find anything in the related Horse, EntityLiving, or PlayerEntity classes. Where is this feature located? Or what might it be called in code so I could run a search for it.
  11. Ah, I did not know EntityDataManager applied to both Client and Server. It works beautifully now, thanks! I may look to see if that can affect my action animation code as that logic was originally written before EntityDataManager was an established thing. Thank you for that little bit about Packets as that helped me better realize what those various functions on SimpleNetworkWrapper are intended to do.
  12. I am working with Packets to assign a value to an Entity's Client Side version to pass animation information to its Model class. This particular value tells the client side entity that the mob has a current target (aggro). Most all of the code I have checked seems to run/fire correctly but the key value I need assigned/changed doesn't change on the client side entity. With this set up, when I run print statements I see the Server side Entity will say true for isAggroed but false for Client side. Here is what I have right now: Entity Class (EntityImmortalArcanine): public boolean isAggroed = false; ....... @Override public void onUpdate() { super.onUpdate(); ..... if(!this.world.isRemote) { System.out.println( "Server isAggroed " + isAggroed ); checkAggro(); } else { System.out.println( "Client isAggroed " + isAggroed ); calculateAggroValue(); } .... } public void checkAggro() { if(this.getAttackTarget() != null) { if(!this.isAggroed) { this.isAggroed = true; KindredLegacyMain.sendMobAggroPacket(this, true); } } else { if(this.isAggroed) { this.isAggroed = false; KindredLegacyMain.sendMobAggroPacket(this, false); } } } @Override public void setAggro(boolean isAggroed) { this.isAggroed = isAggroed; } Main Mod Class (KindredLegacyMain): @EventHandler public void init(FMLInitializationEvent event) { network = NetworkRegistry.INSTANCE.newSimpleChannel(ModInfo.CHANNEL); int packetID = 0; network.registerMessage(PacketAnimation.Handler.class, PacketAnimation.class, packetID, Side.CLIENT); packetID++; network.registerMessage(PacketMobTargeting.Handler.class, PacketMobTargeting.class, packetID, Side.CLIENT); ..... } ....... public static boolean isEffectiveClient() { return FMLCommonHandler.instance().getEffectiveSide().isClient(); } public static void sendMobAggroPacket(IAdvAnimatedEntity entity, boolean isAggroed) { if(isEffectiveClient()) return; entity.setAggro(isAggroed); network.sendToAll(new PacketMobTargeting((boolean)isAggroed, ((Entity)entity).getEntityId())); } Packet Class (PacketMobTargeting): public class PacketMobTargeting implements IMessage { private boolean isTargeting; private int entityID; public PacketMobTargeting() {} public PacketMobTargeting(boolean isTargetingBoolean, int entity) { isTargeting = isTargetingBoolean; entityID = entity; } @Override public void toBytes(ByteBuf buffer) { buffer.writeBoolean(isTargeting); buffer.writeInt(entityID); } @Override public void fromBytes(ByteBuf buffer) { isTargeting = buffer.readBoolean(); entityID = buffer.readInt(); } public static class Handler implements IMessageHandler<PacketMobTargeting, IMessage> { @Override public IMessage onMessage(PacketMobTargeting packet, MessageContext ctx) { World world = KindredLegacyMain.proxy.getWorldClient(); IAdvAnimatedEntity entity = (IAdvAnimatedEntity)world.getEntityByID(packet.entityID); if(entity != null) { entity.setAggro(packet.isTargeting); } return null; } } } Associated Interface (IAdvAnimatedEntity): public interface IAdvAnimatedEntity { void setAggro(boolean isAggro); float getAggroValue(); } This set up is almost identical to an action animation set up I have and that does work correctly.
  13. Thanks! That gave me the direction I needed. And as I started copying over the code to share, I happened to find the issue. The SoundEvent variables for the mob sounds accidentally got replaced from the SoundEvent registry handler Set when I added a new mob to the modification. I did not realize that missing something like that there would not cause a complete failure of the sound playing. Again, thank you!
  14. I encountered a strange issue where 1 of 7 similarly programed custom Tamable mobs in my modification has none of its sounds play when on a Server. Instead you get the default mob sounds. When played on single player, the mob sounds play as expected. I checked the server and client logs when it starts up and I don’t see any messages indicating the files are not loading. Instead, I notice a strange null pointer exception message to sections of code I do not recognize. They appear any time I suspect the mob’s sound is supposed to play, seen below (Client log): [23:47:45] [main/FATAL] [net.minecraft.client.Minecraft]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_51] at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?] at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1087) [bib.class:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?] at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] 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:?] Caused by: java.lang.NullPointerException at net.minecraft.client.audio.PositionedSoundRecord.<init>(SourceFile:34) ~[cgp.class:?] at net.minecraft.client.audio.PositionedSoundRecord.<init>(SourceFile:30) ~[cgp.class:?] at net.minecraft.client.multiplayer.WorldClient.func_184134_a(WorldClient.java:468) ~[bsb.class:?] at net.minecraft.client.multiplayer.WorldClient.func_184148_a(WorldClient.java:456) ~[bsb.class:?] at net.minecraft.client.network.NetHandlerPlayClient.func_184327_a(NetHandlerPlayClient.java:1674) ~[brz.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.func_148833_a(SourceFile:89) ~[kq.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.func_148833_a(SourceFile:11) ~[kq.class:?] at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[hv$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_51] at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?] ... 9 more Does anyone know what might be happening here in this null pointer exception?
  15. I want to add items with a feature where they regenerate durability over time and I am trying to find the most effective or least complicated way to do it. Do either of the following sound ideal: Option 1: Item’s onUpdate() I feel the easiest way would be to add to an Item’s onUpdate() function something like: if(worldTimeTick % 200 == 0) { if(stack.getDamage() > 0) stack.setItemDamage(stack.getDamage() – 1); } If this is even practical, how could I find the “worldTimeTick” and apply it in the Item class? I see Minecraft Clocks use new ResourceLocation("time") Can this be used at all for this and if so, how? Option 2: Capabilities I saw on another post that it you want to track something like time on an Item, you have to do it via Capabilities on its ItemStack. How do/would you even track time with such an option? (I have very primitive understanding of Capabilities)
  16. I tested if the code ran while it was invisible but didn't until it was visible. I am embarrassed to admit but I think I found what happened. As I was changing the code, I left the blocks that were already placed as is. As I was playing around with the blocks in the loaded environment just a few moments ago, I accidentally destroyed one. When I placed a new one down, it no longer turned invisible on loading the game. I deeply thank you for looking at my code and confirming that I did most of this right! It was very difficult to get this far.
  17. Ah! That might be the problem. I don't know where or how to register the TE renderer. Unless you mean the .bindTileEntitySpecialRenderer() mentioned above. That would be in these locations: RenderHandler: public static void registerTileEntityRenders() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityXelNagaPylon.class, new TileEntityXelNagaPylonRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVespeneCondenser.class, new TileEntityVespeneCondenserRenderer()); } RegistryHandler: public static void preInitRegistries() { KindredLegacyEntities.registerEntityMob(); KindredLegacyEntities.registerEntityAbilities(); KindredLegacyEntities.registerEntityProjectiles(); RenderHandler.registerEntityRenders(); RenderHandler.registerTileEntityRenders(); } Main class: @EventHandler public void preInit(FMLPreInitializationEvent event) { ConfigHandler.preInit(event); isBiomesOPlentyEnabled = Loader.isModLoaded("biomesoplenty"); isGalacticraftEnabled = Loader.isModLoaded("galacticraftcore"); networkHelper = new NetworkHelper(ModInfo.CHANNEL2, PoketamableNamePacket.class); RegistryHandler.preInitRegistries(); } A TileEntityRenderer: public class TileEntityXelNagaPylonRenderer extends TileEntitySpecialRenderer<TileEntityXelNagaPylon> { private static final ResourceLocation TEXTURE_XELNAGA_PYLON = new ResourceLocation(ModInfo.MOD_ID + ":" +"textures/blocks/xelnaga_pylon.png"); private static final ResourceLocation TEXTURE_XELNAGA_PYLON_GLOWS = new ResourceLocation(ModInfo.MOD_ID + ":" +"textures/blocks/xelnaga_pylon_glows.png"); private final ModelXelNagaPylon modelXelNagaPylon = new ModelXelNagaPylon(); private final ModelXelNagaPylon modelXelNagaPylonGlows = new ModelXelNagaPylon(); @Override public void render(TileEntityXelNagaPylon tileEntity, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); GL11.glRotatef(180, 0F, 0F, 1F); this.bindTexture(TEXTURE_XELNAGA_PYLON); GL11.glPushMatrix(); this.modelXelNagaPylon.renderModel(0.0625F, (TileEntityXelNagaPylon)tileEntity); GL11.glPopMatrix(); GL11.glPopMatrix(); /* ************ */ GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); GL11.glRotatef(180, 0F, 0F, 1F); this.bindTexture(TEXTURE_XELNAGA_PYLON_GLOWS); float f1 = 1.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDisable(GL11.GL_LIGHTING); char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, f1); GL11.glPushMatrix(); this.modelXelNagaPylonGlows.renderModel(0.0625F, (TileEntityXelNagaPylon)tileEntity); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); GL11.glPopMatrix(); } } There are probably issues with the render() function as I still have a hard time understanding all that GL11 code.
  18. public class BlockXelNagaPylon extends BlockBase { public BlockXelNagaPylon() { super("xelnaga_pylon", Material.ROCK); this.setHardness(2.0F); this.setResistance(10.0F); this.setLightLevel(0.5F); } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { float xx = (float) pos.getX() + 0.5F, yy = (float) pos.getY() + rand.nextFloat() * 6.0F / 16.0F, zz = (float) pos.getZ() + 0.5F, xx2 = rand.nextFloat() * 0.3F - 0.2F, zz2 = 0.5F; worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, (double) (xx), (double) yy, (double) (zz), 0.0F, 0.0F, 0.0F); } @Override public boolean hasTileEntity(IBlockState state) { return true; } @Override public TileEntity createTileEntity(World world, IBlockState state) { return new TileEntityXelNagaPylon(); } }
  19. I'm trying to get a custom modeled block, in the same fashion as the enchanted book on the Enchanting Table, registered and rendered properly. I thought this line was likely what I needed and have tried using it in the same place I register all the renders for my mobs: ClientRegistry.bindTileEntitySpecialRenderer(TileEntityXelNagaPylon.class, new TileEntityXelNagaPylonRenderer()); When you place the block, it displays and animates correctly. However, when you log into the game, the block is invisible unless you left or right click on it. Then the model displays and animates correctly. After playing with it for a while, I have a strong hunch that I should not be using the above line at all. What is the proper way to register a custom modeled block? Here is how I handle the TileEntity registrations if needed: @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(KindredLegacyBlocks.BLOCKS.toArray(new Block[0])); TileEntityHandler.registerTileEntities(); } public static void registerTileEntities() { GameRegistry.registerTileEntity(TileEntityXelNagaPylon.class, new ResourceLocation(ModInfo.MOD_ID, "xelnaga_pylon")); GameRegistry.registerTileEntity(TileEntityVespeneCondenser.class, new ResourceLocation(ModInfo.MOD_ID, "vespene_condenser")); } If it needs mentioning, these are not hybrid model blocks like the Enchanting Table is. Their appearances are entirely defined in their model classes.
  20. I have concept in my modification built off of the PetBats mod where when you drop a certain item on top of another item, something happens. Worked perfectly fine in 1.11.2. Now in 1.12.2, the same section of code doesn't work. Below is that particular section of code: public void revivePoketamable(ItemTossEvent event, TamablePokemon poketamable, EntityItem itemDropped) { final List nearEnts = event.getEntityItem().world.getEntitiesWithinAABBExcludingEntity(itemDropped, itemDropped.getEntityBoundingBox().expand(8D, 8D, 8D)); for (Object o : nearEnts) { if (o instanceof EntityItem) { EntityItem foundItem; foundItem = (EntityItem) o; if (foundItem.getItem().getItem() == KindredLegacyItems.revive_seed) { poketamable.setPosition(itemDropped.posX, itemDropped.posY, itemDropped.posZ); itemDropped.world.spawnEntity(poketamable); poketamable.setHealth(poketamable.getMaxHealth()); // set full entity health event.setCanceled(true); foundItem.getItem().shrink(1); // Decrease itemStack by 1 break; } } } } After various testing, I realized that getEntitiesWithinAABBExcludingEntity() no longer returns EntityItems like it did in 1.11.2. It does detect the player from the event so it is working at all. Is there a way to fix this so it does detect EntityItems again? Or some alternative? I've seen some user complaints on the PetBats mod for 1.12 that seem similar to the problem I am experiencing so I doubt the mod actually works as it was intended for this reason.
  21. Thanks, I was hoping that was the case rather than it was a warning assuring it was gonna be removed. I'm trying to think ahead for scalability into future updates.
  22. Thanks! So with your suggestion I came up with this and it seems to work as desired: @Override //Depreciated public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean p_185477_7_) { if(!(entity instanceof TamablePokemon) && !(entity instanceof EntityPlayer)) { AxisAlignedBB axisalignedbb = state.getBoundingBox(worldIn, pos).offset(pos); if (entityBox.intersectsWith(axisalignedbb)) { collidingBoxes.add(axisalignedbb); } } } Should I be at all concerned that this Method is marked as Depreciated? Like, it getting removed in a future update?
×
×
  • Create New...

Important Information

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