Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Franckyi

Members
  • Posts

    130
  • Joined

  • Last visited

Everything posted by Franckyi

  1. Isn't WorldSavedData deprecated because of capabilities ?
  2. Well, to start modding, you have to learn Minecraft. And to learn Minecraft, you have to play Minecraft. You should start with a very basic Survival World, and see how does the player interact with the world. If you don't understand something, the Minecraft wiki can help you. Then, after spending a few hours (depending if you learn fast or not) on the game, you can start modding. You have the official Forge documentation here. To create a basic mod (adding a block or an item), you don't need a lot of Minecraft knowledge. But when your mod starts to be complicated (networking, capabilities...), you'll need more and more Minecraft knowledge. Also, if you need examples when modding, always look at Minecraft source code. You'll find a lot of examples in the source code, and they will always be up-to-date. Good luck !
  3. Hi ! I created a small mod but I didn't realize the system I used was bad for adding more content. So I decided to rewrite my mod so it's easier to add new content and to allow modders to add their own content to my mod. But I have some general questions before rewriting my mod. 1) The system I use to save my Tile Entity's data. Basically, my mod adds 2 types of blocks : controllers and devices. A device is controlled by 0 to N controllers. You can link a device to a controller by shift-right-clicking the device then shift-right-clicking the controller. This is the basis of my mod. The controller TileEntity stores it's data + all data from every linked device, whereas the device TileEntity only stores his data + the position of all controllers controlling the device. Both use Capabilities. This way I can easily update the controller when the device data changed. But it seems to be a huge use of useless space in NBT data, and the only way to "identify" the device is from it's BlockPos. Instead, should I store controllers datas and devices datas in the World itself ? Each controller/device will have an identifier (integer), and only this identifier will be stored in the TE data. And for the controller for example, I will store which device is linked to the controller using a list of device IDs. If this is more optimized, should I use a WorldSavedData or a Capability ? (basically, I'll be storing a Map<Integer, DeviceData> (or just a List<DeviceData>, though) containing all devices in the world). 2) Using Java 8 features, does this custom IMessageHandler implementation work for both sides ? Thanks for answering
  4. HarvestDropsEvent::getDrops().clear() ?
  5. It won't work. Do what I said and it should work.
  6. What do you mean by "exporting as a jar file" ? Just run gradlew build, and copy the JAR file under build/libs in your mods folder.
  7. ItemTossEvent.class : When you listen to the event, you get the position at the moment when the item is dropped, not when it hits the ground. That's why you always get minecraft:air.
  8. Just copy the mod file in the mods directory (the file has .jar or .zip extension). Don't extract it. Then you can launch Minecraft.
  9. Update to Java 8 update 131, it works perfectly well. The post you linked is 3 years old. The issue has been fixed since a long time. Then launch again.
  10. Please show in which folder are your model and blockstate json files (and also file names). Two FileNotFoundException are thrown, meaning that your files are not located in the correct folder, or they are not named correctly.
  11. You're right ! Now that works. Thanks !
  12. Yeah, that's probably that for the Block::canConnectRedstone. I looked at BlockRedstoneDiode::updateTick but it seems that it only checks if it has power or not - and I want to check how much power I have.
  13. Wait for the mod author to fix this issue. Or accelerate the process by opening an issue here.
  14. Hi ! I'm creating a custom block that recieves a redstone signal from any face. A TileEntity implementing ITickable is created by this block. In the ITickable::update method, I'm getting the current power using World::isBlockIndirectlyGettingPowered. It works...a bit. Screenshot On this screenshot, the block on the right will receive a power of 15 whereas the block on the left will receive a power of 0. I really don't know why. My Block class : public class BlockRedstoneReceiver extends BlockRedstoneDevice { public BlockRedstoneReceiver(String name, Material mat, CreativeTabs tab, float hardness, float resistance, String tool, int harvest, float light) { super(name, mat, tab, hardness, resistance, tool, harvest, light, GuiHandler.REDSTONE_RECEIVER_GUI); } @Override public TileEntity createTileEntity(World world, IBlockState state) { return new TileEntityRedstoneReceiver(); } } The block superclass overrides Block::canConnectRedstone to return true. I'm stuck now. Maybe I forgot something on the block class but I'm not sure... if someone can help me !
  15. 1.7.10 is no longer supported here. But updating your Java version to 1.8 should resolve the problem.
  16. You should use ClientTickEvent.
  17. Hi ! I'm using different types of maps that I have to Serialize to NBT, because they'll be saved in a TileEntity data. So, I decided to create a generic interface for my tables called ITable : package com.github.franckyi.netcraft.logic.tables; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.util.INBTSerializable; public interface ITable<T extends Map<? extends INBTSerializable<? extends NBTBase>, ? extends INBTSerializable<? extends NBTBase>>> extends INBTSerializable<NBTTagList> { public T getTable(); @Override default NBTTagList serializeNBT() { NBTTagList nbt = new NBTTagList(); for (Entry<? extends INBTSerializable<? extends NBTBase>, ? extends INBTSerializable<? extends NBTBase>> entry : getTable() .entrySet()) { NBTTagCompound c = new NBTTagCompound(); c.setTag("Key", entry.getKey().serializeNBT()); c.setTag("Value", entry.getValue().serializeNBT()); nbt.appendTag(c); } return nbt; } @Override default void deserializeNBT(NBTTagList nbt) { for (Iterator<NBTBase> i = nbt.iterator(); i.hasNext();) { NBTTagCompound c = (NBTTagCompound) i.next(); INBTSerializable<NBTBase> key; // I don't know what to do from here INBTSerializable<NBTBase> value; key.deserializeNBT(c.getTag("Key")); value.deserializeNBT(c.getTag("Value")); getTable().put(key, value); } } } But I'm having trouble deserializing the NBT tag to my Table. Should I let the subclass implementing ITable override deserializeNBT, or is there a direct solution in the interface itself ?
  18. MODID:blockstats/fooblock.json <=> src/main/resources/assets/MODID/blockstates/fooblock.json As described here
  19. I think on the Bukkit side, because Forge already knows which discriminator to use, whereas Bukkit doesn't.
  20. The "texture" block of your item models never end. [EDIT] Oops, I was too slow ^^
  21. You should override Block::breakBlock. This method is called before the tile entity is destroyed so you can still access it.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.