
UntouchedWagons
Members-
Posts
156 -
Joined
-
Last visited
Everything posted by UntouchedWagons
-
This is the updateTick method of my block: public void updateTick(World world, int x, int y, int z, Random prng) { if (!world.blockExists(x, y + 1, z)) return; Block b1 = world.getBlock(x, y + 1, z); // If the block above it is farm land (AKA tilled dirt) if (b1 instanceof BlockFarmland) { if (!world.blockExists(x, y + 2, z)) return; // Get the block above that one Block plant_block = world.getBlock(x, y + 2, z); if (plant_block instanceof IPlantable || plant_block instanceof IGrowable) { plant_block.updateTick(world, x, y + 2, z, this.prng); } } else if (b1 instanceof BlockDirt || b1 instanceof BlockGrass || b1 instanceof BlockSand || b1 instanceof BlockSoulSand) { if (!world.blockExists(x, y + 2, z)) return; // Get the block above that one Block b2 = world.getBlock(x, y + 2, z); if (b2 instanceof BlockSapling || b2 instanceof BlockNetherWart) { b2.updateTick(world, x, y + 2, z, this.prng); } // Reeds and saplings are a bit different else if (b2 instanceof BlockReed || b2 instanceof BlockCactus) { System.out.println("Cactus tick a"); for (int l = 1; world.blockExists(x, y + 1 + l, z) && l < 3; l++) { System.out.println("Cactus tick b"); world.getBlock(x, y + 1 + l, z) .updateTick(world, x, y + 1 + l, z, this.prng); } } } else b1.updateTick(world, x, y + 1, z, prng); } It works fine for seeds, potatoes, carrots, nether wart, melon and pumpkin stems great. However my block doesn't seem to work with cactus or sugar cane and I'm not sure why. According to BlockReed's updateTick method it checks if the block above it is air and if it is, calculates the height of the plant. Then if it's less than 3, it then checks if its metadata is 15 (not sure of the circumstances for this check). If it is 15, it places a reed above it. The only reason I think this is failing is because the metadata isn't 15.
-
Consider the following code: List<ItemStack> potion_subtypes = new ArrayList<ItemStack>(); Items.potionitem.getSubItems(Items.potionitem, null, potion_subtypes); for (ItemStack is : potion_subtypes) { System.out.println(is.getUnlocalizedName() + " =>" + is.getDisplayName()); } It prints the following: item.potion =>Water Bottle item.potion =>Potion of Regeneration item.potion =>Potion of Regeneration item.potion =>Potion of Regeneration item.potion =>Splash Potion of Regeneration item.potion =>Splash Potion of Regeneration item.potion =>Splash Potion of Regeneration item.potion =>Potion of Swiftness item.potion =>Potion of Swiftness item.potion =>Potion of Swiftness item.potion =>Splash Potion of Swiftness item.potion =>Splash Potion of Swiftness item.potion =>Splash Potion of Swiftness item.potion =>Potion of Fire Resistance item.potion =>Potion of Fire Resistance item.potion =>Splash Potion of Fire Resistance item.potion =>Splash Potion of Fire Resistance item.potion =>Potion of Poison item.potion =>Potion of Poison item.potion =>Potion of Poison item.potion =>Splash Potion of Poison item.potion =>Splash Potion of Poison item.potion =>Splash Potion of Poison item.potion =>Potion of Healing item.potion =>Potion of Healing item.potion =>Splash Potion of Healing item.potion =>Splash Potion of Healing item.potion =>Potion of Night Vision item.potion =>Potion of Night Vision item.potion =>Splash Potion of Night Vision item.potion =>Splash Potion of Night Vision item.potion =>Potion of Weakness item.potion =>Potion of Weakness item.potion =>Splash Potion of Weakness item.potion =>Splash Potion of Weakness item.potion =>Potion of Strength item.potion =>Potion of Strength item.potion =>Potion of Strength item.potion =>Splash Potion of Strength item.potion =>Splash Potion of Strength item.potion =>Splash Potion of Strength item.potion =>Potion of Slowness item.potion =>Potion of Slowness item.potion =>Splash Potion of Slowness item.potion =>Splash Potion of Slowness item.potion =>Potion of Harming item.potion =>Potion of Harming item.potion =>Splash Potion of Harming item.potion =>Splash Potion of Harming item.potion =>Potion of Water Breathing item.potion =>Potion of Water Breathing item.potion =>Splash Potion of Water Breathing item.potion =>Splash Potion of Water Breathing item.potion =>Potion of Invisibility item.potion =>Potion of Invisibility item.potion =>Splash Potion of Invisibility item.potion =>Splash Potion of Invisibility How come awkward potions, mundane potions and clear potions aren't listed? How do I get a list of the subtypes that include those? Also, how do I get a list of the potions' crafting recipes?
-
Java 7 is fine.
-
What kind of stuff do you put in the proxy classes?
-
I'm the developer of the Minecraft Resource Calculator and I'm currently working on a mod that'll make adding mods to my calculator easier. The mod is currently able to save mod data, item data, oredict stuff and the conventional recipes to an SQLite database. The one thing I forgot about was processing "leftover" stuff in recipes, like buckets when making cake. So I need to add support for that. In the second code snippet you posted, itemstack1 would be a milk bucket (in the cake example) and itemstack2 would be an empty bucket. Is that right?
-
I don't have an answer for you but resistance controls if it can be destroyed by creepers, ghast fireballs, tnt, wither blasts, etc...
-
Sorry for the incredibly vague request. What my mod will doing is iterating through the item registry, the oredict registry and the recipes and saving them to an SQLite database. It will be a tool to help adding mod support to my Resource Calculator. However some mods have special crafting systems like Thaumcraft and Botania so addons to my mod will need to provide a service to process those. Now what I'd like to know it how should those addons register themselves with my mod? The simplest way is a singleton but my mod would end up having several singletons and while I think singletons are okay when used sparingly, 5 or 6 of them is too many. I was thinking of using Java's ServiceLoader class to find classes that inherit an abstract class and do dependency injection.
-
Yeah they mean the fluid registry. It was added in 1.5 I think. It's what allows you to use steam from Rail Craft in Big Reactor turbines for example, both mods add their own steam but they're interchangeable thanks to the registry.
-
[Solved]Making unique unlocalized names for each item
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
I figured out what I need to do. I need to wrap the Block bits with Item.getItemFromBlock: this.unlocalized_name_override.put(Item.getItemFromBlock(Blocks.brown_mushroom), "tile.mushroom.brown"); this.unlocalized_name_override.put(Item.getItemFromBlock(Blocks.red_mushroom), "tile.mushroom.red"); this.unlocalized_name_override.put(Item.getItemFromBlock(Blocks.brown_mushroom_block), "tile.mushroomBlock.brown"); this.unlocalized_name_override.put(Item.getItemFromBlock(Blocks.red_mushroom_block), "tile.mushroomBlock.red"); -
This thread is a continuation of my previous one but I felt a new thread would be better. I want to store all the items, recipes and other related stuff in a MySQL database for later use. I'm storing the items' data in a table like so: CREATE TABLE `items` ( `unlocalized_name` varchar(192) NOT NULL, `sub_id` int(11) NOT NULL DEFAULT '0', `localized_name` varchar(256) DEFAULT NULL, `owning_mod` varchar(128) NOT NULL, PRIMARY KEY (`unlocalized_name`,`sub_id`), KEY `owning_mod_idx` (`owning_mod`), CONSTRAINT `owning_mod` FOREIGN KEY (`owning_mod`) REFERENCES `mods` (`mod`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; I plan on dropping the sub_id column once I get this issue sorted out. Some items in the game like records, mushrooms and pressure plates (stone and wood) have the same unlocalized name so I need to make custom ones. In my mod's constructor I have this: this.unlocalized_name_override = new HashMap<Object, String>(); this.unlocalized_name_override.put(Blocks.brown_mushroom, "tile.mushroom.brown"); this.unlocalized_name_override.put(Blocks.red_mushroom, "tile.mushroom.red"); this.unlocalized_name_override.put(Blocks.brown_mushroom_block, "tile.mushroomBlock.red"); this.unlocalized_name_override.put(Blocks.red_mushroom_block, "tile.mushroomBlock.red"); this.unlocalized_name_override.put(Blocks.stone_pressure_plate, "tile.pressurePlate.stone"); this.unlocalized_name_override.put(Blocks.wooden_pressure_plate, "tile.pressurePlate.wood"); this.unlocalized_name_override.put(Items.record_11, "item.record.11"); this.unlocalized_name_override.put(Items.record_13, "item.record.13"); this.unlocalized_name_override.put(Items.record_blocks, "item.record.blocks"); this.unlocalized_name_override.put(Items.record_cat, "item.record.cat"); this.unlocalized_name_override.put(Items.record_chirp, "item.record.chirp"); this.unlocalized_name_override.put(Items.record_far, "item.record.far"); this.unlocalized_name_override.put(Items.record_mall, "item.record.mall"); this.unlocalized_name_override.put(Items.record_mellohi, "item.record.mellohi"); this.unlocalized_name_override.put(Items.record_stal, "item.record.stal"); this.unlocalized_name_override.put(Items.record_strad, "item.record.strad"); this.unlocalized_name_override.put(Items.record_wait, "item.record.wait"); this.unlocalized_name_override.put(Items.record_ward, "item.record.ward"); When I run the '/dump' command through the chat this code is run: ArrayList<ItemStack> items = new ArrayList<ItemStack>(); for (Object io : Item.itemRegistry) { Item i = (Item)io; i.getSubItems(i, null, items); } ps = this.conn.prepareStatement("INSERT INTO items (`unlocalized_name`, `sub_id`, `localized_name`, `owning_mod`) VALUES (?, ?, ?, ?);"); for (ItemStack is : items) { Item i = is.getItem(); String unlocalized_name; String localized_name = is.getDisplayName(); String mod_id = Util.getModId(is.getItem()); if (this.unlocalized_name_override.containsKey(i)) unlocalized_name = this.unlocalized_name_override.get(i); else unlocalized_name = i.getUnlocalizedName(); ps.setString(1, unlocalized_name); ps.setInt(2, is.getItemDamage()); ps.setString(3, localized_name); ps.setString(4, mod_id); ps.execute(); } ps.close(); Now for the records, this works just fine: SELECT unlocalized_name FROM mcrd.items WHERE unlocalized_name LIKE 'item.record%'; item.record.11 item.record.13 item.record.blocks item.record.cat item.record.chirp item.record.far item.record.mall item.record.mellohi item.record.stal item.record.strad item.record.wait item.record.ward But for mushrooms or pressure plates it doesn't work, no row with the unlocalized name of tile.mushroom.brown or tile.pressurePlate.stone exists. I suspect it has to do with the fact that the records are items while the pressure plates and mushrooms are blocks but I don't know what to do about it.
-
I've read diesieben07's and Ablaze's tutorials on the SNI stuff and I still don't quite understand it. I'm working on a mod with a single block which is a tile entity that has two inventories. Basically what I want to know is when the inventory gets updated (however that happens, I assume there's an event to use) I create an appropriate packet and send it using the static SNW instance I made in the preInit event? Also, how do I convert all the ItemStacks in the inventories into bytes for the toBytes method when my packet class implements IMessage? Also, how do I know what value to pass for the fourth paramter of registerMessage?
-
I'm iterating through the item registry like so: for (Object io : Item.itemRegistry) { Item i = (Item)io; } Now what I want to do is save all the items in the registry to a mysql database. That I can do no problem. What the problem is is that some items have the same unlocalized name but are different Blocks, like wood and stone pressure plates. They have the same unlocalized name but are different objects. If I try something like this: for (Object io : Item.itemRegistry) { if (io.equals(Blocks.stone_pressure_plate)) { System.out.println("Yup this is a stone pressure plate"); } } I never get the message. I'm storing all the items in a MySQL table created like so: CREATE TABLE `items` ( `unlocalized_name` varchar(192) NOT NULL, `sub_id` int(11) NOT NULL DEFAULT '0', `localized_name` varchar(256) DEFAULT NULL, `owning_mod` varchar(128) NOT NULL, PRIMARY KEY (`unlocalized_name`,`sub_id`), CONSTRAINT `owning_mod` FOREIGN KEY (`owning_mod`) REFERENCES `mods` (`mod`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Since wood and stone pressure plates have the same unlocalized name (tile.pressurePlate) and the same damage value (0), I can't have both so I'd need to adjust the unlocalized name for both pressure plates. How can I correctly detect if a given instance is a certain block?
-
[1.7.10]How do I check if an item has variants?
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
Yeah that's basically what I want to make, an exporter to export all registered items and their subtypes, etc... to a MySQL database. The only issue I had was getting the subtypes. Know that I know how to do that I should be good to go. -
[1.7.10]How do I check if an item has variants?
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
No the mod I'm working on has no items or blocks. I'm the maker on the Minecraft Resource Calculator, all the items and recipes are stored in JSON files with each mod having its own file. Adding support for a mod can be quite complicated depending on how large it is. I want to try and make it easier by taking all the items and recipes (I know I'd need extra code for some mods) in minecraft and dumping them to a MySQL database. The SQL stuff I can do, it's just doing what I want within Minecraft. -
[1.7.10]How do I check if an item has variants?
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
I'm not sure how it works under the hood but instances of the Item class have a getSubItems method, not a getSubBlocks method which makes sense I guess. However the BlockWood class has a getSubBlocks method. I dunno lol. I don't know what's going on here. I'm looking at the BlockWood class and it defines an array of the six log types but when I iterate through Item.itemRegistry, Acacia and Dark Oak show up later on after stained glass panes.