-
Posts
852 -
Joined
-
Last visited
Everything posted by Bektor
-
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Yeah, this is because I never got to the point to create the JSON files for everything. I'm just writing all the code and the last thing I'm doing is adding the JSON files. Mostly this results into the JSON files beeing added a few hours before I build a new alpha version. This JSON will come later. I just added the other jsons to see if it is working for the world. For the item json I have to figure out how to use the 3D model from the world for the inventory and rotate it in a good direction with some submodels beeing added. How can I fix this? EDIT: I replaced the line which caused the error now with "inventory": [{ "transform": "forge:default-block" }]. But the problem with all the other errors still remains. My block is still just displayed as a normal block with a missing texture instead of the model I defined. -
What do you mean by null is there for the compiler? I am wondering why the compiler just doesn't cast it then automatically to the correct type (I know C++ can do this, but don't ask me in which cases C++ will do this automatically ^^) Also if null can be anything, how does it work to check if an object is null or not if it can be anything. Thought I'm wondering what this in memory actually is if it can be anything. Will the PC just say, ok there you go, take this bit of RAM with whatever might be left in there and let it be null.
-
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
There you go. It should be noted that the JSON file itself is registered correctly as before implementing all the variants it worked fine. -
It wasn't the tiles own capability function. It is a method which should check if a given tile entity has the capability at the given orientation. The method is used when for example a cable or a machine or whatever wants the send energy, but beforehand make sure that the block to which the energy should be send even got the capability. Thought in your second answer I noticed that some variable moved to some place it was never supposed to be in the first place. The variable side should be used in the if-statement like in all other statements, but it was not which resulted into the crash as the variable orientation got never casted to EnumFacing if it was null. Thought in my opinion null is still null, but without the cast it seems like it is not quite null (I don't know the internal processing there). So using the side variable which should have been used (and probalby was before some internal code iterations) solves the problem.
-
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Hm.. interesting... Different from what I'm used to. For some reason I'm getting errors with the JSON: [00:25:07] [Client thread/ERROR] [FML]: Exception loading model for variant justanotherenergy:cable#east=false,north=true,south=false,west=true for blockstate "justanotherenergy:cable[east=false,north=true,south=false,west=true]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justanotherenergy:cable#east=false,north=true,south=false,west=true with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:264) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:252) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:159) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] 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_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1257) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 21 more cable.json { "forge_marker": 1, "defaults": { "model": "cable_base", "textures": { "all": "justanotherenergy:blocks/cable" } }, "variants": { "normal": { "model": "cable_base" }, "north": { "submodel": "cable_side" }, "south": { "submodel": "cable_side" }, "east": { "submodel": "cable_side" }, "west": { "submodel": "cable_side" }, "inventory": [{ "transform": "cable_side" }] } } cable_base.json (cable_side is currently just a 1:1 copy with different naming) { "parent": "cable_base", "texture": { "particle": "justanotherenergy:blocks/cable", "texture": "justanotherenergy:blocks/cable", "overlay": "justanotherenergy:blocks/cable" }, "elements": [ { "from": [ 4, 4, 4 ], "to": [ 12, 12, 12 ], "faces": { "down": { "cullface": "down" }, "up": { "cullface": "up" }, "north": { "cullface": "north" }, "south": { "cullface": "south" }, "west": { "cullface": "west" }, "east": { "cullface": "east" } } } ] } I know that the error tells me some variants are missing, but I've got the north, south, east and west and even the normal variant [just in case]. -
Ok.... wtf have I done there.... Must have been one of these midnight programming nights. ^^
-
I just copied the one line into the post, but here is the complete method. Arguments used: the tilenentity, null public static boolean hasCapability(TileEntity tile, EnumFacing orientation) { EnumFacing side = orientation != null ? orientation.getOpposite() : (EnumFacing) null; if(tile.hasCapability(CapabilityEnergy.ENERGY, orientation)) return true; else if(TeslaHelper.isEnergyHolder(tile, side)) return true; else if(TeslaHelper.isEnergyProducer(tile, side)) return true; else if(TeslaHelper.isEnergyReceiver(tile, side)) return true; return false; }
-
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
That's then beyond my knowledge of grammar. That's my understanding: And -> implement both Or -> implement either A or B only -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Yeah, totally forgot those. Thought why the 'or' and not 'and'? For everything else I always used both. -
Hi, I'm wondering how I can work around an NPE caused by tile.hasCapability(CapabilityEnergy.ENERGY, (EnumFacing) null). The code there should actually check if the TileEntity has the capability at all without taking care of the sides. (thus all sides are checked first and then the side null at last) Reasons for having the null check there: Thx in advance. Bektor
-
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
public class BlockCable extends Block implements ITileEntityProvider { /** Whether this fence connects in the northern direction */ public static final PropertyBool NORTH = PropertyBool.create("north"); /** Whether this fence connects in the eastern direction */ public static final PropertyBool EAST = PropertyBool.create("east"); /** Whether this fence connects in the southern direction */ public static final PropertyBool SOUTH = PropertyBool.create("south"); /** Whether this fence connects in the western direction */ public static final PropertyBool WEST = PropertyBool.create("west"); private static final AxisAlignedBB BOX_CENTER = new AxisAlignedBB(.25d, .25d, .25d, .75d, .75d, .75d); private static final AxisAlignedBB BOX_DOWN = new AxisAlignedBB(.25d, 0d, .25d, .75d, .25d, .75d); private static final AxisAlignedBB BOX_UP = new AxisAlignedBB(.25d, .75d, .25d, .75d, 1d, .75d); private static final AxisAlignedBB BOX_NORTH = new AxisAlignedBB(.25d, .25d, 0d, .75d, .75d, .25d); private static final AxisAlignedBB BOX_SOUTH = new AxisAlignedBB(.25d, .25d, .75d, .75d, .75d, 1); private static final AxisAlignedBB BOX_WEST = new AxisAlignedBB(0d, .25d, .25d, .25d, .75d, .75d); private static final AxisAlignedBB BOX_EAST = new AxisAlignedBB(.75d, .25d, .25d, 1d, .75d, .75d); // TODO: remove unused code private static final AxisAlignedBB[] BOX_FACES = { BOX_DOWN, BOX_UP, BOX_NORTH, BOX_SOUTH, BOX_WEST, BOX_EAST }; public BlockCable() { super(Material.IRON); this.setHardness(.25f); this.setResistance(3f); this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false)); this.setCreativeTab(ModCreativeTabs.mcpowerTab); } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isFullBlock(IBlockState state) { return false; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_CENTER); if(state.getValue(NORTH)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_NORTH); return; }else if(state.getValue(EAST)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_EAST); return; }else if(state.getValue(WEST)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_WEST); return; }else if(state.getValue(SOUTH)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_SOUTH); return; } } @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { return state.withProperty(NORTH, this.canCableConnectTo(worldIn, pos, EnumFacing.NORTH)) .withProperty(EAST, this.canCableConnectTo(worldIn, pos, EnumFacing.EAST)) .withProperty(WEST, this.canCableConnectTo(worldIn, pos, EnumFacing.WEST)) .withProperty(SOUTH, this.canCableConnectTo(worldIn, pos, EnumFacing.SOUTH)); } private boolean canCableConnectTo(IBlockAccess worldIn, BlockPos pos, EnumFacing facing) { return worldIn.getBlockState(pos.offset(facing)).getBlock() == ModBlocks.cable || worldIn.getBlockState(pos.offset(facing)).getBlock() == ModBlocks.transfer; } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); } Hm... this code seems not to work. -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Well, I've never heard of both of them until today. ^^ -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Ah, ok. Thought what's the difference between those two? -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
https://minecraft.gamepedia.com/Model Or just look into fence.json from Minecraft. -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Error: Parse error on line 12: ..."cable_base" }, { "when": { " ---------------------^ Expecting 'STRING', got '{' I'm using Eclipse with the Eclipse Web Developer Tools Plugin installed (which comes with a JSON editor besides HTML etc.). Meaning I should do it like this? Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_CENTER); if(state.getValue(NORTH)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_NORTH); -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Ok, I've got this done now, thought I'm getting a few errors: Can't really tell what these errors are as the JSON support for my IDE is just crap, I mean, everything is nice (even xml support etc.) except for JSON. I've always got the feeling eclipse doesn't like json files. { "forge_marker": 1, "defaults": { "model": "cable_center", "textures": {"all": "justanotherenergy:blocks/cable"} }, "multipart": { "apply": { "model": "cable_base" }, { // error "when": { "north": "true" }, "apply": {"model": "cable_side" } }, { "when": { "east": "true" }, "apply": {"model": "cable_side" } }, { "when": { "south": "true" }, "apply": {"model": "cable_side" } }, { "when": { "west": "true" }, "apply": {"model": "cable_side" } }, }, "variants": { "inventory": [{"transform": "forge:default-block"}] // where to put this? } } I'm also wondering how to combine multiply collision boxes to one collision box. public class BlockCable extends Block implements ITileEntityProvider { /** Whether this fence connects in the northern direction */ public static final PropertyBool NORTH = PropertyBool.create("north"); /** Whether this fence connects in the eastern direction */ public static final PropertyBool EAST = PropertyBool.create("east"); /** Whether this fence connects in the southern direction */ public static final PropertyBool SOUTH = PropertyBool.create("south"); /** Whether this fence connects in the western direction */ public static final PropertyBool WEST = PropertyBool.create("west"); private static final AxisAlignedBB BOX_CENTER = new AxisAlignedBB(.25d, .25d, .25d, .75d, .75d, .75d); private static final AxisAlignedBB BOX_DOWN = new AxisAlignedBB(.25d, 0d, .25d, .75d, .25d, .75d); private static final AxisAlignedBB BOX_UP = new AxisAlignedBB(.25d, .75d, .25d, .75d, 1d, .75d); private static final AxisAlignedBB BOX_NORTH = new AxisAlignedBB(.25d, .25d, 0d, .75d, .75d, .25d); private static final AxisAlignedBB BOX_SOUTH = new AxisAlignedBB(.25d, .25d, .75d, .75d, .75d, 1); private static final AxisAlignedBB BOX_WEST = new AxisAlignedBB(0d, .25d, .25d, .25d, .75d, .75d); private static final AxisAlignedBB BOX_EAST = new AxisAlignedBB(.75d, .25d, .25d, 1d, .75d, .75d); private static final AxisAlignedBB[] BOX_FACES = { BOX_DOWN, BOX_UP, BOX_NORTH, BOX_SOUTH, BOX_WEST, BOX_EAST }; public BlockCable() { super(Material.IRON); this.setHardness(.25f); this.setResistance(3f); this.setCreativeTab(ModCreativeTabs.mcpowerTab); } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isFullBlock(IBlockState state) { return false; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) { TileEntity tile = worldIn.getTileEntity(pos); if(tile == null) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB); return; } if(state.getValue(NORTH)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_CENTER + BOX_FACES[2]); return; }else if(state.getValue(EAST)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB); return; }else if(state.getValue(WEST)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB); return; }else if(state.getValue(SOUTH)) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB); return; } } @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { return state.withProperty(NORTH, true) // TODO: value .withProperty(EAST, false) .withProperty(WEST, false) .withProperty(SOUTH, false); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); } -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Hm... Having a boolean for each direction sounds like creating more property values than really necessary. I'm also wondering what this ExtendedBlockState is which for example BC 8.0 uses for their pipes. -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor replied to Bektor's topic in Modder Support
Ok, thx. Which would then be the best way to let the json now in which direction the block is connected to? (multiply connections at the same time possible) Also, how should I handle the stuff with the collision boxes? -
[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)
Bektor posted a topic in Modder Support
Hi, I'm wondering which is the best way to let to cables connect to each other with changing the model and the collision boxes for each possible connection and none connection. It should be noted here that the cable will have some other states, too (not yet implemented) for stuff like different ratios of energy transfer (haven't planned yet how to implement it code-wise). change collision box on new connection to match with look change model on new connection, so two cables look connected ingame blockstates for stuff like energy transfer rates might be implemented in the future public class BlockCable extends Block implements ITileEntityProvider { private static final AxisAlignedBB BOX_CENTER = new AxisAlignedBB(.25d, .25d, .25d, .75d, .75d, .75d); private static final AxisAlignedBB BOX_DOWN = new AxisAlignedBB(.25d, 0d, .25d, .75d, .25d, .75d); private static final AxisAlignedBB BOX_UP = new AxisAlignedBB(.25d, .75d, .25d, .75d, 1d, .75d); private static final AxisAlignedBB BOX_NORTH = new AxisAlignedBB(.25d, .25d, 0d, .75d, .75d, .25d); private static final AxisAlignedBB BOX_SOUTH = new AxisAlignedBB(.25d, .25d, .75d, .75d, .75d, 1); private static final AxisAlignedBB BOX_WEST = new AxisAlignedBB(0d, .25d, .25d, .25d, .75d, .75d); private static final AxisAlignedBB BOX_EAST = new AxisAlignedBB(.75d, .25d, .25d, 1d, .75d, .75d); private static final AxisAlignedBB[] BOX_FACES = { BOX_DOWN, BOX_UP, BOX_NORTH, BOX_SOUTH, BOX_WEST, BOX_EAST }; public BlockCable() { super(Material.IRON); this.setHardness(.25f); this.setResistance(3f); this.setCreativeTab(ModCreativeTabs.mcpowerTab); } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isFullBlock(IBlockState state) { return false; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) { TileEntity tile = worldIn.getTileEntity(pos); if(tile == null) { Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB); return; } } { "forge_marker": 1, "defaults": { "model": "cube_all", "textures": {"all": "justanotherenergy:blocks/cable"} }, "variants": { "normal": { "model": "cube_all" }, "inventory": [{"transform": "forge:default-block"}] } } My problem with this is, I've never worked in 1.8.9+ with collision boxes and I don't know which would be the best way to implement the model in json files. For the JSON files I thought about using sub-models, but I want to know if there is a better way or if it is already the best way. I am also wondering if I have to add the same code for the sub-models multiply times because of having other blockstates, too (which might change nothing on the look of the block or change only the texture etc.). Thx in advance. Bektor -
Ok, that worked. Thx.
-
I'm still getting this error with Java 8. I've got Java 9 JRE and JDK installed and Java 8 JDK. My path variable is set to Java 9 while I've writtin this line into my gradle.properties: org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8\\ org.gradle.jvmargs=-Xmx3G
-
Hi, I've got the problem that I cannot setup my project after I re-installed Windows (and added JUnit 5 to build.gradle, thought never tested it without JUnit 5). The last setup before adding JUnit 5 and re-installing Windows ran perfectly fine. minecraft_version=1.11.2 forge_version=13.20.1.2454 mappings=stable_32 task wrapper(type: Wrapper) { gradleVersion = '4.1' } // the error > Configure project : This mapping 'stable_32' was designed for MC 1.11! Use at your own peril. > Task :fixMcSources Patching failed: minecraft\net\minecraft\util\math\Cartesian.java Hunk 1 failed! Cannot find hunk target } public List<T> apply(@Nullable Object[] p_apply_1_) { - return Arrays.<T>asList((Object[])p_apply_1_); + return Arrays.<T>asList((T[])p_apply_1_); } } File state package net.minecraft.util.math; import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.UnmodifiableIterator; import java.lang.reflect.Array; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; import javax.annotation.Nullable; public class Cartesian { public static <T> Iterable<T[]> func_179318_a(Class<T> p_179318_0_, Iterable<? extends Iterable<? extends T>> p_179318_1_) { return new Cartesian.Product(p_179318_0_, (Iterable[])func_179322_b(Iterable.class, p_179318_1_)); } public static <T> Iterable<List<T>> func_179321_a(Iterable<? extends Iterable<? extends T>> p_179321_0_) { return func_179323_b(func_179318_a(Object.class, p_179321_0_)); } private static <T> Iterable<List<T>> func_179323_b(Iterable<Object[]> p_179323_0_) { return Iterables.transform(p_179323_0_, new Cartesian.GetList()); } private static <T> T[] func_179322_b(Class<? super T> p_179322_0_, Iterable<? extends T> p_179322_1_) { List<T> list = Lists.<T>newArrayList(); for(T t : p_179322_1_) { list.add(t); } return (T[])((Object[])list.toArray(func_179319_b(p_179322_0_, list.size()))); } private static <T> T[] func_179319_b(Class<? super T> p_179319_0_, int p_179319_1_) { return (T[])((Object[])((Object[])Array.newInstance(p_179319_0_, p_179319_1_))); } static class GetList<T> implements Function<Object[], List<T>> { private GetList() { } public List<T> apply(@Nullable Object[] p_apply_1_) { return Arrays.asList((Object[])p_apply_1_); } } static class Product<T> implements Iterable<T[]> { private final Class<T> field_179429_a; private final Iterable<? extends T>[] field_179428_b; private Product(Class<T> p_i46020_1_, Iterable<? extends T>[] p_i46020_2_) { this.field_179429_a = p_i46020_1_; this.field_179428_b = p_i46020_2_; } public Iterator<T[]> iterator() { return (Iterator<T[]>)(this.field_179428_b.length <= 0?Collections.singletonList((Object[])Cartesian.func_179319_b(this.field_179429_a, 0)).iterator():new Cartesian.Product.ProductIterator(this.field_179429_a, this.field_179428_b)); } static class ProductIterator<T> extends UnmodifiableIterator<T[]> { private int field_179426_a; private final Iterable<? extends T>[] field_179424_b; private final Iterator<? extends T>[] field_179425_c; private final T[] field_179423_d; private ProductIterator(Class<T> p_i46018_1_, Iterable<? extends T>[] p_i46018_2_) { this.field_179426_a = -2; this.field_179424_b = p_i46018_2_; this.field_179425_c = (Iterator[])Cartesian.func_179319_b(Iterator.class, this.field_179424_b.length); for(int i = 0; i < this.field_179424_b.length; ++i) { this.field_179425_c[i] = p_i46018_2_[i].iterator(); } this.field_179423_d = Cartesian.func_179319_b(p_i46018_1_, this.field_179425_c.length); } private void func_179422_b() { this.field_179426_a = -1; Arrays.fill(this.field_179425_c, (Object)null); Arrays.fill(this.field_179423_d, (Object)null); } public boolean hasNext() { if(this.field_179426_a == -2) { this.field_179426_a = 0; for(Iterator<? extends T> iterator1 : this.field_179425_c) { if(!iterator1.hasNext()) { this.func_179422_b(); break; } } return true; } else { if(this.field_179426_a >= this.field_179425_c.length) { for(this.field_179426_a = this.field_179425_c.length - 1; this.field_179426_a >= 0; --this.field_179426_a) { Iterator<? extends T> iterator = this.field_179425_c[this.field_179426_a]; if(iterator.hasNext()) { break; } if(this.field_179426_a == 0) { this.func_179422_b(); break; } iterator = this.field_179424_b[this.field_179426_a].iterator(); this.field_179425_c[this.field_179426_a] = iterator; if(!iterator.hasNext()) { this.func_179422_b(); break; } } } return this.field_179426_a >= 0; } } public T[] next() { if(!this.hasNext()) { throw new NoSuchElementException(); } else { while(this.field_179426_a < this.field_179425_c.length) { this.field_179423_d[this.field_179426_a] = this.field_179425_c[this.field_179426_a].next(); ++this.field_179426_a; } return (T[])((Object[])this.field_179423_d.clone()); } } } } } Patching failed: minecraft\net\minecraft\client\renderer\texture\TextureManager.java Hunk 2 failed! Cannot find hunk target this.field_110585_a.put(p_110579_1_, (ITextureObject)p_110579_2_); flag = false; } catch (Throwable throwable) { + final ITextureObject p_110579_2_f = p_110579_2_; CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture"); CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered"); crashreportcategory.func_71507_a("Resource location", p_110579_1_); crashreportcategory.func_189529_a("Texture object class", new ICrashReportDetail<String>() { public String call() throws Exception { - return p_110579_2_.getClass().getName(); + return p_110579_2_f.getClass().getName(); } }); throw new ReportedException(crashreport); File state package net.minecraft.client.renderer.texture; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Map.Entry; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.ITextureObject; import net.minecraft.client.renderer.texture.ITickable; import net.minecraft.client.renderer.texture.ITickableTextureObject; import net.minecraft.client.renderer.texture.SimpleTexture; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; import net.minecraft.crash.ICrashReportDetail; import net.minecraft.util.ReportedException; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @SideOnly(Side.CLIENT) public class TextureManager implements ITickable, IResourceManagerReloadListener { private static final Logger field_147646_a = LogManager.getLogger(); private final Map<ResourceLocation, ITextureObject> field_110585_a = Maps.<ResourceLocation, ITextureObject>newHashMap(); private final List<ITickable> field_110583_b = Lists.<ITickable>newArrayList(); private final Map<String, Integer> field_110584_c = Maps.<String, Integer>newHashMap(); private final IResourceManager field_110582_d; public TextureManager(IResourceManager p_i1284_1_) { this.field_110582_d = p_i1284_1_; } public void func_110577_a(ResourceLocation p_110577_1_) { ITextureObject itextureobject = (ITextureObject)this.field_110585_a.get(p_110577_1_); if(itextureobject == null) { itextureobject = new SimpleTexture(p_110577_1_); this.func_110579_a(p_110577_1_, itextureobject); } TextureUtil.func_94277_a(itextureobject.func_110552_b()); } public boolean func_110580_a(ResourceLocation p_110580_1_, ITickableTextureObject p_110580_2_) { if(this.func_110579_a(p_110580_1_, p_110580_2_)) { this.field_110583_b.add(p_110580_2_); return true; } else { return false; } } public boolean func_110579_a(ResourceLocation p_110579_1_, final ITextureObject p_110579_2_) { boolean flag = true; try { ((ITextureObject)p_110579_2_).func_110551_a(this.field_110582_d); } catch (IOException ioexception) { field_147646_a.warn("Failed to load texture: {}", new Object[]{p_110579_1_, ioexception}); p_110579_2_ = TextureUtil.field_111001_a; this.field_110585_a.put(p_110579_1_, p_110579_2_); flag = false; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture"); CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered"); crashreportcategory.func_71507_a("Resource location", p_110579_1_); crashreportcategory.func_189529_a("Texture object class", new ICrashReportDetail<String>() { public String call() throws Exception { return p_110579_2_.getClass().getName(); } }); throw new ReportedException(crashreport); } this.field_110585_a.put(p_110579_1_, p_110579_2_); return flag; } public ITextureObject func_110581_b(ResourceLocation p_110581_1_) { return (ITextureObject)this.field_110585_a.get(p_110581_1_); } public ResourceLocation func_110578_a(String p_110578_1_, DynamicTexture p_110578_2_) { Integer integer = (Integer)this.field_110584_c.get(p_110578_1_); if(integer == null) { integer = Integer.valueOf(1); } else { integer = Integer.valueOf(integer.intValue() + 1); } this.field_110584_c.put(p_110578_1_, integer); ResourceLocation resourcelocation = new ResourceLocation(String.format("dynamic/%s_%d", new Object[]{p_110578_1_, integer})); this.func_110579_a(resourcelocation, p_110578_2_); return resourcelocation; } public void func_110550_d() { for(ITickable itickable : this.field_110583_b) { itickable.func_110550_d(); } } public void func_147645_c(ResourceLocation p_147645_1_) { ITextureObject itextureobject = this.func_110581_b(p_147645_1_); if(itextureobject != null) { TextureUtil.func_147942_a(itextureobject.func_110552_b()); } } public void func_110549_a(IResourceManager p_110549_1_) { for(Entry<ResourceLocation, ITextureObject> entry : this.field_110585_a.entrySet()) { this.func_110579_a((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); } } } FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':fixMcSources'. > com.cloudbees.diff.PatchException: Cannot find hunk target * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. * Get more help at https://help.gradle.org BUILD FAILED in 15s 6 actionable tasks: 5 executed, 1 up-to-date Note: I've got Java JDK 9 installed. Before I re-installed Windows I've got Java JDK 8 installed. Thx in advance. Bektor
-
What I want to do is replace the ore generation in a way that my mod decides where to put the ores. For example minecraft generates small veins and many which are evenly distributed in the world. Then my mod comes and stops minecraft iron ore generation and generates the iron from minecraft unevenly and seldom in large veins throught the world. So Minecraft doesn't generate the ore at all and my mod generates it instead after my rules and settings. That's what I want to do. (something which could be achieved with a custom terrain generator, atleast for Minecraft ores itself, thought mod ores aren't handled that way and it would mean it is incompatible with other terrain generators) Both mods are open source or source visible (CoFHWorld). And GeoCraft also goes the way of using ASM and hacking into config systems to disable ore generation. I don't know how the code of Geocraft actually works, but I know that GeoCraft uses ASM to replace all calls to generate with its generateHook to disable all ore generation for mods which use the generate methods and for all those other mods it goes the way of reflection with chaning the configs and stuff like that. Thought I want to avoid this way if possible. Note: it might not be true what I wrote above about how GeoCraft works. I just figured this out with asking some people and trying to understand the code... or atleast parts of it.. thought I mostly just got it from answers as I don't really get the code behind the stuff. Thought CoFHWorld seems to me way more complicated as GeoCraft, even when CoFHWorld doesn't use ASM while GeoCraft does. I never really got it why Geocraft uses chunk save and load events, thought CoFHWorld uses it, too, if I remember correclty. In GeoCraft the tick event also is used to not generate all ores at once, but instead generate them over time to reduce lag if I recall correctly. Hm... sounds like a lot of extre work for the world generation, meaning the world generation will slow down.
-
Hi, I'm currently wondering how I can disable ore generation for other mods to replace it with my own ore generation. So actually something like GeoCraft which also disabled ore generation for other mods to replace it. (Maybe that CoFHWorld does also something similiar, but not sure if this mod also replaced mod ore generation, but it does this with Vanilla ones). As of my knowledge I could achieve this with reflection using some mods config systems and ASM, thought I don't really want to go that way. My problem now is that I don't know how to do it. I know of the OreGenEvent.GenerateMinable event (this event needs really some documentation) because of CoFH World, but that's where my knowledge starts and where it ends. Thought by just reading about all those cascading world generation, I don't think I can relly on this event to stop mod ore generation. This is how far I've got: public class OreEventHandler { private static HashSet<EventType> vanillaGenEvents = new HashSet<>(); static { vanillaGenEvents.add(EventType.ANDESITE); vanillaGenEvents.add(EventType.COAL); vanillaGenEvents.add(EventType.DIAMOND); vanillaGenEvents.add(EventType.DIORITE); vanillaGenEvents.add(EventType.DIRT); vanillaGenEvents.add(EventType.EMERALD); vanillaGenEvents.add(EventType.GOLD); vanillaGenEvents.add(EventType.GRANITE); vanillaGenEvents.add(EventType.GRAVEL); vanillaGenEvents.add(EventType.IRON); vanillaGenEvents.add(EventType.LAPIS); vanillaGenEvents.add(EventType.REDSTONE); vanillaGenEvents.add(EventType.QUARTZ); vanillaGenEvents.add(EventType.SILVERFISH); } @SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true) public void handleOreGen(OreGenEvent.GenerateMinable event) { if(OreEventHandler.vanillaGenEvents.contains(event.getType())) event.setResult(Event.Result.DENY); } } Note: Besides removing mods ore generation, how am I about to re-add ores like iron to the world generation again, as using the default way will probably not work as of the event above. Thx in advance. Bektor
-
Hi, I'm getting currently the problem that I can't download the windows installer of Forge 1.12.1 - 14.22.0.2475 from files.minecraftforge.net. My browser Vivaldi 1.11.917.43 shows me that it is downloaded but for some reason the file does not get saved. A Windows restart doesn't solve the problem and saving to other hard drives does also not solve the problem. Note: Only happens with this specific version of Forge. All other versions are working. After using my fallback browser Firefox I was finally able to download this version of Forge, but whenever I want to execute it, I'm getting this error: Note: Only happens with this specific version of Forge. All other versions are working. Also my anti-virus tool wanted me to stop the download (not happened for the part described further above with Vivaldi) because the file is dangeours. Well, just skipped that, but after that, Windows blocks the execution. Thx in advance. Bektor