American2050
Members-
Posts
553 -
Joined
Everything posted by American2050
-
[Solved] [1.12.2] Can't get the block name
American2050 replied to American2050's topic in Modder Support
Sorry, not sure what you mean. -
[Solved] [1.12.2] Can't get the block name
American2050 replied to American2050's topic in Modder Support
Here is the code been called on a block with a TE: ItemStack theStackInside = ((TECobblestoneGenerator) tileentity).getStackInSlot(0); System.out.println(theStackInside.getCount() + " " + I18n.format(theStackInside.getItem().getUnlocalizedName())); And the TE: private NonNullList<ItemStack> generatorItemStacks = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY); @Override public ItemStack getStackInSlot(int index) { return this.generatorItemStacks.get(index); } @Override public void setInventorySlotContents(int index, ItemStack stack) { ItemStack itemstack = this.generatorItemStacks.get(index); boolean flag = !stack.isEmpty() && stack.isItemEqual(itemstack) && ItemStack.areItemStackTagsEqual(stack, itemstack); this.generatorItemStacks.set(index, stack); if (stack.getCount() > this.getInventoryStackLimit()) { stack.setCount(this.getInventoryStackLimit()); } if (index == 0 && !flag) { this.markDirty(); } } @Override public void update() { if (!this.world.isRemote) { this.cooldown++; if(cooldown >= 100) { this.cooldown = 0; ItemStack stackInside = this.getStackInSlot(0); if(stackInside!=null) { if(stackInside.getItem() != Item.getItemFromBlock(Blocks.COBBLESTONE)) { this.setInventorySlotContents(0, new ItemStack(Blocks.COBBLESTONE,1,0)); } else if(stackInside.getCount() < this.getInventoryStackLimit()) { stackInside.grow(1); } } } } } -
How do I get the name of the item/block on an itemstack? I tried I18n.format(theStackInside.getItem().getUnlocalizedName())); But I get "tile.stonebrick" when the idea is that I should get "Cobblestone" PS: Not even sure why it says stonebrick there. And I believe that's the main error. The ItemStack I confirmed it's a cobblestone ItemStack.
-
As for now I tried a "not so nice way" and by subscribing to onBlockRegister I just called event.getRegistry().getEntries() and made a list that way. My "problem" is that I only get the block, and I don't think I can get the variants for each block from there. Where can I get those like for planks get {minecraft:planks:0},{minecraft:planks:1},{minecraft:planks:2},{minecraft:planks:3},{minecraft:planks:4},{minecraft:planks:5} And same for all the blocks. PS: Is ok to get them that way, or should I get the variants and not the meta? For example in the case I later need to call it from my code.
-
[1.12.2] Block with property boolean error
American2050 replied to American2050's topic in Modder Support
Thanks you. -
I wonder what I'm doing wrong here. Trying to register a block with a property boolean for "Powered" but I get an error and not sure what causes it. I have: public class BlockZand extends GenericModBlockFalling implements IHasModel{ public static final PropertyBool POWERED = PropertyBool.create("powered"); public BlockZand(Material materialIn, String name) { super(materialIn, name); this.setUnlocalizedName(ModInfo.MODID + ":" + name); this.setHardness(1.0F); this.setSoundType(SoundType.SAND); this.setTickRandomly(true); this.setLightLevel(5F); this.setDefaultState(this.blockState.getBaseState().withProperty(POWERED, Boolean.valueOf(false))); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } The error: [12:16:18] [main/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.RegistryEvent$Register@11c929a2: java.lang.ExceptionInInitializerError: null at com.mramericanmike.zand.handlers.RegistryHandler.onBlockRegister(RegistryHandler.java:24) ~[RegistryHandler.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_5_RegistryHandler_onBlockRegister_Register.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143) ~[EventBus$1.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) [EventBus.class:?] at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:736) [GameData.class:?] at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:603) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:270) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:513) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_151] 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_151] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_151] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.IllegalArgumentException: Cannot set property PropertyBool{name=powered, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in BlockStateContainer{block=null, properties=[]} at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:221) ~[BlockStateContainer$StateImplementation.class:?] at com.mramericanmike.zand.blocks.BlockZand.<init>(BlockZand.java:45) ~[BlockZand.class:?] at com.mramericanmike.zand.init.ModBlocks.<clinit>(ModBlocks.java:15) ~[ModBlocks.class:?] The registration: @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event){ event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } I guess my problem is that I'm either extending wrong classes or trying to set the default value at the wrong time? Thanks for your help.
-
For me it makes things easiers to stay on the newest one, specially between same version of MC. So yes 1.11.2 and 1.12.2 is always where I'm aiming towards. Same was for 1.7.10 and 1.10.2
-
As Mod Makers, should we even code our mods for 1.11 1.11.1 and/or 1.12 1.12.1 Or is it ok to only push updates for 1.11.2 and 1.12.2? I'm nout sure of the incompatibilities between those version, but is it ok to encourage ModPack makers to use 1.11.2 and 1.12.2 and not the other versions?
-
Issues with "gradlew setupDecompWorkplace"
American2050 replied to Metrixo's topic in Modder Support
What's on line 10 of that file? -
[SOLVED] [1.12.2] Cancel updateTick onNeighborChange
American2050 replied to American2050's topic in Modder Support
Ohhh never mind me. I just noticed, I was using updateTick. Changed to randomTick and problem solved. -
[SOLVED] [1.12.2] Cancel updateTick onNeighborChange
American2050 replied to American2050's topic in Modder Support
Nothing special: @Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { super.updateTick(world, pos, state, rand); if (!world.isRemote) { if(world.getBlockState(pos.add(0,2,0)).getBlock() instanceof IPlantable && world.isAirBlock(pos.add(0,3,0))){ for(int i = 0; i < ConfigValues.growAttempts; i++){ world.getBlockState(pos.add(0,2,0)).getBlock().updateTick(world, pos.add(0,2,0), world.getBlockState(pos.add(0,2,0)), rand); } } else if (world.getBlockState(pos.add(0,1,0)).getBlock() instanceof IPlantable && world.isAirBlock(pos.add(0,2,0))){ for(int i = 0; i < ConfigValues.growAttempts; i++){ world.getBlockState(pos.add(0,1,0)).getBlock().updateTick(world, pos.add(0,1,0), world.getBlockState(pos.add(0,1,0)), rand); } } } } -
Is there a way to cancel the updateTick method on my block whenever onNeighborChange happens? I'm using updateTick to randomly make crops planted on my block to grow faster, but I notice that each time a neighbor of my block changes, the updateTick method gets called making things "faster" than they should. Can I cancel this behavior?
-
[Solved] Need some guidance on custom world generation
American2050 replied to American2050's topic in Modder Support
Thanks Jabelar, I will have to make and take some time to sit and really dig into this and investigate Some day I will get this done. Thanks for the tips and the guide, definitely going to be reading it. -
[Solved] Need some guidance on custom world generation
American2050 replied to American2050's topic in Modder Support
I found what was the "bump" I hit, even if I create my OneChunkGenerator, the method generateChunk(int x, int z) is been called from ChunkProviderServer so I guess I can't make it create just one chunk from the generator itself, but I have to keep going up. -
[Solved] Need some guidance on custom world generation
American2050 replied to American2050's topic in Modder Support
Thanks gonna take a look on that. I guess I kinda found that route, but forgot what bump I hit Gonna give it a try again and see how it goes. -
Can someone explain me what the point of a ResourceLocation is? Like before we could create an entity like this Entity entityX2 = (Entity) EntityList.createEntityByName("PrimedTnt", world); But now we need a ResourceLocation. Entity entityX2 = (Entity) EntityList.createEntityByIDFromName(new ResourceLocation("PrimedTnt"), world); What is the main idea behind doing it that way?
-
[Solved] Need some guidance on custom world generation
American2050 posted a topic in Modder Support
I'm trying to figure out what I would need to do in order to create a new world type. I have seen vanilla classes and kinda understand what some of them do. What I want to achieve is to have a world type that will generate a regular world but will generate only the 1st chunk and nothing else. Any guidance on what I should do to achieve this is appreciate. Thanks a lot. -
Thanks. I changed it to LivingUpdateEvent Working perfectly now.
-
I have an event that monitors living events so I can do some stuff with pigs. Problem is that whenever I try to launch a world on 1.12.2 I get this error. (This worked on 1.11.2) [18:48:36] [main/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.player.ItemTooltipEvent@618b0680: java.lang.NullPointerException: null at com.mramericanmike.cropdusting.events.EntityTickEvent.onEntityTick(EntityTickEvent.java:24) ~[EntityTickEvent.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_17_EntityTickEvent_onEntityTick_LivingEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) ~[EventBus.class:?] at net.minecraftforge.event.ForgeEventFactory.onItemTooltip(ForgeEventFactory.java:284) ~[ForgeEventFactory.class:?] at net.minecraft.item.ItemStack.getTooltip(ItemStack.java:993) ~[ItemStack.class:?] at net.minecraft.client.Minecraft.lambda$populateSearchTreeManager$1(Minecraft.java:625) ~[Minecraft.class:?] at net.minecraft.client.util.SearchTree.index(SearchTree.java:93) ~[SearchTree.class:?] at net.minecraft.client.util.SearchTree.add(SearchTree.java:78) ~[SearchTree.class:?] at java.lang.Iterable.forEach(Unknown Source) [?:1.8.0_151] at net.minecraft.client.Minecraft.populateSearchTreeManager(Minecraft.java:639) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.reloadSearchTrees(FMLClientHandler.java:1119) [FMLClientHandler.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.reloadSearchTrees(FMLCommonHandler.java:771) [FMLCommonHandler.class:?] at net.minecraftforge.common.ForgeModContainer.mappingChanged(ForgeModContainer.java:554) [ForgeModContainer.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_151] at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) [guava-21.0.jar:?] at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) [guava-21.0.jar:?] at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) [guava-21.0.jar:?] at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) [guava-21.0.jar:?] at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) [guava-21.0.jar:?] at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) [guava-21.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:217) [guava-21.0.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:253) [LoadController.class:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:231) [LoadController.class:?] at net.minecraftforge.fml.common.Loader.fireRemapEvent(Loader.java:900) [Loader.class:?] at net.minecraftforge.registries.GameData.freezeData(GameData.java:235) [GameData.class:?] at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:728) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:352) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:581) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_151] 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_151] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_151] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_151] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] [18:48:36] [main/ERROR] [FML]: Index: 1 Listeners: [18:48:36] [main/ERROR] [FML]: 0: NORMAL [18:48:36] [main/ERROR] [FML]: 1: ASM: com.mramericanmike.cropdusting.events.EntityTickEvent@4882c984 onEntityTick(Lnet/minecraftforge/event/entity/living/LivingEvent;)V [18:48:36] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods [18:48:36] [main/WARN]: Skipping bad option: lastServer: [18:48:36] [main/INFO]: Narrator library for x64 successfully loaded The line is: @SubscribeEvent public void onEntityTick(LivingEvent event) { EntityLivingBase theEntity = event.getEntityLiving(); World theWorld = theEntity.getEntityWorld(); Right there on World theWorld = theEntity.getEntityWorld(); is the error. Not sure why it would be null
-
Cool thanks Now that you mention, then yes I got it working, I was just looking for the json files on the wrong place. Thanks. Now to learn conditional and ready to fully update with json recipes Thanks for the patience.
-
[1.12.2] Help with InGame Config Screen
American2050 replied to American2050's topic in Modder Support
Damn I feel stupid everytime... I was missing this. @Override public boolean hasConfigGui() { // TODO Auto-generated method stub return true; } I had it on false -
I always seam to have problems when updating mods with the Configs Screen to show from the game itself. Always miss some detail and not on 1.12.2 not sure where my error could me. I have everything that I had on 1.11.x only thing changed are the methods on my GuiFactory and now the screen is provided this way @Override public GuiScreen createConfigGui(GuiScreen parentScreen) { // TODO Auto-generated method stub return new ModGuiConfig(parentScreen); } But it's not working. What could I be missing? I have: @Mod(modid = ModInfo.MODID, name = ModInfo.MOD_NAME, version = ModInfo.VERSION, guiFactory = ModInfo.GUI_FACTORY_CLASS, acceptedMinecraftVersions = ModInfo.ACCEPTED_VERSIONS) and: public static final String GUI_FACTORY_CLASS = "com.mramericanmike.barebones.client.gui.ModGuiFactory"; I'm lost this time, once again.
-
I guess I have used it wrong. Gonna try it again on a general testing mod I have. The idea is that I register recipes with that new method and then call the function to generate the json files. Then I remove all that and leave only the .json right? Or I misunderstood what that does.