Jump to content

sequituri

Forge Modder
  • Posts

    669
  • Joined

  • Last visited

Posts posted by sequituri

  1. i changed the adding slots part, however i am a little confused about needing multiple slot classes, can you please explain a little bit.

    Also, i still have the problem with the gui image, and how to actually make recipes, if you can tell me how to do that, i would greatly appreciate it.

    mkay... first take a look at the Slot classes currently in Minercraft: Slot, BeaconSlot, CreativeSlot, Ingredient, Potion, SlotCrafting, SlotFurnace, SlotMerchantResult, and the dynamic new Slot calls. Each overrides certain slot checks, such as isItemValid(itemStack), canTakeStack(player), ... and such.

     

    Each slot controls the GUI of the container it is used with. So, in most cases (unless it's a generic accept anything input/output slot), you'd want to specialize it for your gui.

     

    Now, as far as recipes go, I cannot really help you with those as I have no idea how your infuser should work. If you could hash out the details on what goes in and what comes out, that would be a start.

  2. You could conceivably store up to 5 block types in meta data along with rotations considering that logs only allow for 3 axes (X, Y, and Z orientation) Y means log is vertical, X and Z point log along that axis.

     

    So, given metadata range of 0-15, you could encode 3 orientations by 5 subtypes in a block. You would have to do the math or use a array though to get and set metadata and subtypes.

  3. The ExtendedBlockStorage array has one element for each strata (16 strata are possible, each of 16 blocks height).

    So, extBlockArray[0] is the lowest strata (blocks x,0-15,y) are in it.

     

     

     

    Use something like this:

    import net.minecraft.block.Block;
    import net.minecraft.init.Blocks;
    import net.minecraft.world.chunk.Chunk;
    import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
    import net.minecraftforge.event.terraingen.PopulateChunkEvent;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    
    public class StoneLayerGen {
    @SubscribeEvent
    public void populateChunk(PopulateChunkEvent.Pre event) {
    	final Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ);
    	final ExtendedBlockStorage[] storageArray = chunk.getBlockStorageArray();
    	for (int x = 0; x < 16; x++) {
    		for (int z = 0; z < 16; z++) {
    			ExtendedBlockStorage storage = storageArray[0]; // 0 <= y < 16
    			if (storage != null) {
    				for (int y = 0; y < 16; y++) {
    					final Block block = storage.getBlockByExtId(x, y, z);
    					if (block == Blocks.coal_ore) {
    						storage.setExtBlockMetadata(x, level, z, ModBlocks.stratifiedCoalOre.damageDropped(0));
    					}
    
    					if (block == Blocks.emerald_ore) {
    						storage.setExtBlockMetadata(x, level, z, ModBlocks.stratifiedEmeraldOre.damageDropped(0));
    					}
    
    					if (block == Blocks.gold_ore) {
    						storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedGoldOre.damageDropped(0));
    					}
    
    					if (block == Blocks.iron_ore) {
    						storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedIronOre.damageDropped(0));
    					}
    
    					if (block == Blocks.lapis_ore) {
    						storage.setExtBlockMetadata(x, y, z,
    								ModBlocks.stratifiedLapisOre.damageDropped(0));
    					}
    
    					if (block == Blocks.stone) {
    						storage.setExtBlockMetadata(x, y, z,
    								ModBlocks.coloredStone.damageDropped(4));
    					}
    				}
    			}
    			storage = storageArray[1]; // 16 <= y < 32
    			if (storage != null) {
    				for (int y = 0; y < 16; y++) {
    					if (storage != null) {
    						final Block block = storage[strata]
    								.getBlockByExtId(x, level, z);
    
    						if (storage.getBlockByExtId(x, y, z) == Blocks.coal_ore) {
    							storage.setExtBlockMetadata(x, y, z,
    									ModBlocks.stratifiedCoalOre
    											.damageDropped(2));
    						}
    
    						if (storage.getBlockByExtId(x, y, z) == Blocks.emerald_ore) {
    							storage.setExtBlockMetadata(x, y, z,
    									ModBlocks.stratifiedEmeraldOre
    											.damageDropped(1));
    						}
    
    						if (storage.getBlockByExtId(x, y, z) == Blocks.gold_ore) {
    							storage.setExtBlockMetadata(x, y, z,
    									ModBlocks.stratifiedGoldOre
    											.damageDropped(1));
    						}
    
    						if (storage.getBlockByExtId(x, y, z) == Blocks.iron_ore) {
    							storage.setExtBlockMetadata(x, y, z,
    									ModBlocks.stratifiedIronOre
    											.damageDropped(2));
    						}
    
    						if (storage.getBlockByExtId(x, y, z) == Blocks.lapis_ore) {
    							storage.setExtBlockMetadata(x, y, z,
    									ModBlocks.stratifiedLapisOre
    											.damageDropped(1));
    						}
    
    						if (storage.getBlockByExtId(x, y, z) == Blocks.stone) {
    							storage.setExtBlockMetadata(x, y, z,
    									ModBlocks.coloredStone.damageDropped(1));
    						}
    					}
    					storage = storageArray[2]; // 32 <= y < 48
    					if (storage != null) {
    						for (int y = 0; y < 16; y++) {
    							if (storage.getBlockByExtId(x, y, z) == Blocks.coal_ore) {
    								storage.setExtBlockMetadata(x, y, z,
    										ModBlocks.stratifiedCoalOre.damageDropped(3));
    							}
    
    							if (storage.getBlockByExtId(x, y, z) == Blocks.emerald_ore) {
    								storage.setExtBlockMetadata(x, y, z,
    										ModBlocks.stratifiedEmeraldOre.damageDropped(2));
    							}
    
    							if (storage.getBlockByExtId(x, y, z) == Blocks.gold_ore) {
    								storage.setExtBlockMetadata(x, y, z,
    										ModBlocks.stratifiedGoldOre.damageDropped(2));
    							}
    
    							if (storage.getBlockByExtId(x, y, z) == Blocks.iron_ore) {
    								storage.setExtBlockMetadata(x, y, z,
    										ModBlocks.stratifiedIronOre.damageDropped(3));
    							}
    
    							if (storage.getBlockByExtId(x, y, z) == Blocks.lapis_ore) {
    								storage.setExtBlockMetadata(x, y, z,
    										ModBlocks.stratifiedLapisOre.damageDropped(2));
    							}
    
    							if (storage.getBlockByExtId(x, y, z) == Blocks.stone) {
    								storage.setExtBlockMetadata(x, y, z,
    										ModBlocks.coloredStone.damageDropped(14));
    							}
    						}
    					}
    					for (int y = 64; y < 256; y++) {
    						storage = storageArray[y >> 4];
    						final int level = y & 15;
    						if (storage != null) {
    							if (storage.getBlockByExtId(x, level, z) == Blocks.coal_ore) {
    								storage.setExtBlockMetadata(x, level, z,
    										ModBlocks.stratifiedCoalOre.damageDropped(1));
    							}
    
    							if (storage.getBlockByExtId(x, level, z) == Blocks.iron_ore) {
    								storage.setExtBlockMetadata(x, level, z,
    										ModBlocks.stratifiedIronOre.damageDropped(1));
    							}
    
    							if (storage.getBlockByExtId(x, level, z) == Blocks.stone) {
    								storage.setExtBlockMetadata(x, level, z,
    										ModBlocks.coloredStone.damageDropped(6));
    							}
    						}
    					}
    				}
    			}
    		}
    	}
    }
    

     

     

    Hope this helps.

  4. You are making two mistakes.

    a) You are trying to use a variable that is not in scope or has never been defined. In your case, you never define such a variable and no other 'world' is in scope.

    b) You need to understand how arguments work, in the declaration you have a list of these: methodName(Type1 formal1, Type1 formal2, ... )

      these formals are local to your method as variable names, the Typen are just specifiers for the type(Class) of each argument,.

     

    Also, if you want a world variable, then you need to either define it with: World world or rename the parameter of World type from arg3 to world. Simple as that.

     

    That said, go learn how to read & write java.

  5. Well, actually a utility mod is not the same thing as an API library. An API library use usually just a jar of java classes with source in a jar (and any jar of natives if it uses the JNI system). It is normally added to the build path and parts can be included in the final jar.

     

    A utility mod is one that is a dependency and is a full mod in its own right with either necessary linkage points or an API-only version. It can be made to be necessary or optional. Inter-mod coms can be useful in this case.

     

    There are other permutations and variants as well, but this seems to be the norm.

  6. The slots are fine (apart from 2 of them being slightly out of place), however i am not sure if i have done it right, here is what i have for the setting the slots

     

    this.addSlotToContainer(new Slot(teAngellicInfuser, 0, 49, 35));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 1, 49, 17));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 2, 7, 40));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 4, 49, 53));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 5, 67, 17));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 6, 67, 40));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 7, 67, 53));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 8, 85, 17));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 9, 85, 40));

    this.addSlotToContainer(new Slot(teAngellicInfuser, 10, 85, 53));

    this.addSlotToContainer(new SlotAngellicInfuser(invPlayer.player, teAngellicInfuser, 3, 143, 34));

     

    Try this:

    this.addSlotToContainer( new SlotAngellicInfuser( teAngellicInfuser, n, x, y) // replace n x and y with your own data.

     

    by using new Slot, you are accepting vanilla slot semantics which you have no control over.

     

    Also, if I understand your needs properly, 9 slots should be input/output, 1 slot needs to be fuel only, and one output only. So, one slot class will not likely suffice unless a vanilla slot type fits your needs.

  7.  

     

    I would also need to copy the entire NBT serializer/deserializer.

     

    Or... you could implement a transaction log for each TE and when changing NBT data also copy the path "I:Rieka/TEUsage/suchAndSo" to the log (Set<String> tlog).

     

    Then when you send update package, use the tlog to send only changed data and then clear it.

  8.     return par1ItemStack;
    
        ArrowNockEvent event = new ArrowNockEvent( par3EntityPlayer, par1ItemStack); // this is the error this comment isn't actually here 
    

    It should be pretty obvious to any modder that no code after an unconditional 'return' statement could possibly get executed.

  9. Have you tried using the simplimpl package and the SimpleChannelHandlerWrapper and SimpleNetworkWrapper classes?

    I have no idea what the "simplimpl" package is, but the Wrapper classes are for the Forge packet system, not vanilla.

    I take it from that answer that you have no desire whatsoever to use Forge netty support and will only work on a vanilla packet solution.

    That's cool by me and good luck with it.

  10. By the way...

    Mods that require a server side as well should always have a NetworkCheckHandler thusly:

    class MyMod {
    ...
      @NetworkCheckHandler
      public static boolean nameDoesn'tMatterHere(Map<String, String> theMap, Side theSide) {
        //TODO check the map and see if you have the right mods
        return isThisMapOkay;
      }
    ...
    }
    

  11. I have no error message. A normal Mod seems to be disabled when joining a Server with the mod not installed. (For instance: You have two Mods installed, maybe Thaumcraft and a Minimap and join a vanilla server, Thaumcraft is completely disabled while you still have your Minimap)

    That is likely due to the fact that Thaumcraft properly checks the server for the mod and disables itself. All mods should do this, but most of them are not written properly. In other words, the server does not disable mods, nor does Forge unless the mod requests it.

×
×
  • Create New...

Important Information

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