Jump to content

Bektor

Forge Modder
  • Posts

    852
  • Joined

  • Last visited

Everything posted by Bektor

  1. Ok, thx. Is this build.gradle so correct?: // For those who want the bleeding edge buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' // define the properties file ext.configFile = file "build.properties" configFile.withReader { // read config. def prop = new Properties() prop.load(it) ext.config = new ConfigSlurper().parse prop } version = "${config.minecraft_version}-${config.primeval_major}.${config.primeval_minor}.${config.primeval_revision}-${config.primeval_build}" group= "minecraftplaye.primevalforest" archivesBaseName = "primevalforest" sourceCompatibility = '1.8' targetCompatibility = '1.8' minecraft { version = config.minecraft_version + "-" + config.forge_version if(file('../run').exists()) { runDir = "../run/assets" } else { runDir = "assets" } // simply re-run your setup task after changing the mappings to update your workspace. mappings = "${config.primeval_mappings}" makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. replace "@VERSION@", project.version replaceIn "lib/Constants.java" if(project.hasProperty("signature")) replace "@FINGERPRINT@", signature } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } task incrementBuildNumber() { dependsOn "reobf" doLast { config.primeval_build = (config.primeval_build.toString().toInteger()) + 1 configFile.withWriter { config.toProperties().store(it, "") } } } jar { appendix = 'universal' } task releaseJars(type: Copy) { from incrementBuildNumber from nameOfJarTask } EDIT: task releaseJars(type: Copy) { from incrementBuildNumber from nameOfJarTask } I'm getting an error at from nameOfJarTask. Could not find property 'nameOfJarTask' on task ':releaseJars'.
  2. Ok, thx. Is this build.gradle so correct?: // For those who want the bleeding edge buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' // define the properties file ext.configFile = file "build.properties" configFile.withReader { // read config. def prop = new Properties() prop.load(it) ext.config = new ConfigSlurper().parse prop } version = "${config.minecraft_version}-${config.primeval_major}.${config.primeval_minor}.${config.primeval_revision}-${config.primeval_build}" group= "minecraftplaye.primevalforest" archivesBaseName = "primevalforest" sourceCompatibility = '1.8' targetCompatibility = '1.8' minecraft { version = config.minecraft_version + "-" + config.forge_version if(file('../run').exists()) { runDir = "../run/assets" } else { runDir = "assets" } // simply re-run your setup task after changing the mappings to update your workspace. mappings = "${config.primeval_mappings}" makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. replace "@VERSION@", project.version replaceIn "lib/Constants.java" if(project.hasProperty("signature")) replace "@FINGERPRINT@", signature } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } task incrementBuildNumber() { dependsOn "reobf" doLast { config.primeval_build = (config.primeval_build.toString().toInteger()) + 1 configFile.withWriter { config.toProperties().store(it, "") } } } jar { appendix = 'universal' } task releaseJars(type: Copy) { from incrementBuildNumber from nameOfJarTask } EDIT: task releaseJars(type: Copy) { from incrementBuildNumber from nameOfJarTask } I'm getting an error at from nameOfJarTask. Could not find property 'nameOfJarTask' on task ':releaseJars'.
  3. ClientProxy package com.minecolonies.proxy; import com.minecolonies.blocks.ModBlocks; import com.minecolonies.client.gui.WindowBuildTool; import com.minecolonies.client.gui.WindowCitizen; import com.minecolonies.client.render.EmptyTileEntitySpecialRenderer; import com.minecolonies.client.render.RenderBipedCitizen; import com.minecolonies.client.render.RenderFishHook; import com.minecolonies.client.render.TileEntityScarecrowRenderer; import com.minecolonies.colony.CitizenData; import com.minecolonies.entity.EntityCitizen; import com.minecolonies.entity.EntityFishHook; import com.minecolonies.event.ClientEventHandler; import com.minecolonies.items.ModItems; import com.minecolonies.tileentities.ScarecrowTileEntity; import com.minecolonies.tileentities.TileEntityColonyBuilding; import com.schematica.client.events.TickHandler; import com.schematica.client.renderer.RendererSchematicGlobal; import com.schematica.world.SchematicWorld; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.BlockPos; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { private RendererSchematicGlobal rendererSchematicGlobal; private SchematicWorld schematicWorld = null; @Override public boolean isClient() { return true; } @Override public void registerKeyBindings() { // for(KeyBinding keyBinding : KeyInputHandler.KEY_BINDINGS) // { // ClientRegistry.registerKeyBinding(keyBinding); // } } @Override public void registerEvents() { super.registerEvents(); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); //Schematica MinecraftForge.EVENT_BUS.register(new TickHandler()); this.rendererSchematicGlobal = new RendererSchematicGlobal(); MinecraftForge.EVENT_BUS.register(this.rendererSchematicGlobal); } @Override public void registerEntityRendering() { RenderingRegistry.registerEntityRenderingHandler(EntityCitizen.class, RenderBipedCitizen::new); RenderingRegistry.registerEntityRenderingHandler(EntityFishHook.class, RenderFishHook::new); } @Override public void registerTileEntityRendering() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityColonyBuilding.class, new EmptyTileEntitySpecialRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(ScarecrowTileEntity.class, new TileEntityScarecrowRenderer()); } @Override public void showCitizenWindow(CitizenData.View citizen) { WindowCitizen window = new WindowCitizen(citizen); window.open(); } @Override public void openBuildToolWindow(BlockPos pos) { WindowBuildTool window = new WindowBuildTool(pos); window.open(); } //Schematica @Override public void setActiveSchematic(SchematicWorld world) { this.schematicWorld = world; } @Override public SchematicWorld getActiveSchematic() { return this.schematicWorld; } @Override public void registerRenderer() { super.registerRenderer(); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutBaker), 0, new ModelResourceLocation(ModBlocks.blockHutBaker.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutBlacksmith), 0, new ModelResourceLocation(ModBlocks.blockHutBlacksmith.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutBuilder), 0, new ModelResourceLocation(ModBlocks.blockHutBuilder.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutCitizen), 0, new ModelResourceLocation(ModBlocks.blockHutCitizen.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutFarmer), 0, new ModelResourceLocation(ModBlocks.blockHutFarmer.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutFisherman), 0, new ModelResourceLocation(ModBlocks.blockHutFisherman.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutLumberjack), 0, new ModelResourceLocation(ModBlocks.blockHutLumberjack.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutMiner), 0, new ModelResourceLocation(ModBlocks.blockHutMiner.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutStonemason), 0, new ModelResourceLocation(ModBlocks.blockHutStonemason.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutTownHall), 0, new ModelResourceLocation(ModBlocks.blockHutTownHall.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutWarehouse), 0, new ModelResourceLocation(ModBlocks.blockHutWarehouse.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockSubstitution), 0, new ModelResourceLocation(ModBlocks.blockSubstitution.getRegistryName(), "inventory")); //Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutField), 0, new ModelResourceLocation(ModBlocks.blockHutField.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.buildTool, 0, new ModelResourceLocation(ModItems.buildTool.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.caliper, 0, new ModelResourceLocation(ModItems.caliper.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.scanTool, 0, new ModelResourceLocation(ModItems.scanTool.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.supplyChest, 0, new ModelResourceLocation(ModItems.supplyChest.getRegistryName(), "inventory")); ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.blockHutField), 0, ScarecrowTileEntity.class); } } Main class: package com.minecolonies; import com.minecolonies.blocks.ModBlocks; import com.minecolonies.colony.Schematics; import com.minecolonies.configuration.ConfigurationHandler; import com.minecolonies.configuration.Configurations; import com.minecolonies.items.ModItems; import com.minecolonies.lib.Constants; import com.minecolonies.network.messages.*; import com.minecolonies.proxy.IProxy; import com.minecolonies.util.Log; import com.minecolonies.util.RecipeHandler; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; @Mod(modid = Constants.MOD_ID, name = Constants.MOD_NAME, version = Constants.VERSION, certificateFingerprint = Constants.FINGERPRINT, dependencies = Constants.FORGE_VERSION, acceptedMinecraftVersions = Constants.MC_VERSION) public class MineColonies { private static SimpleNetworkWrapper network; @Mod.Instance(Constants.MOD_ID) public static MineColonies instance; @SidedProxy(clientSide = Constants.CLIENT_PROXY_LOCATION, serverSide = Constants.SERVER_PROXY_LOCATION) public static IProxy proxy; public static SimpleNetworkWrapper getNetwork() { return network; } @Mod.EventHandler public void invalidFingerprint(FMLFingerprintViolationEvent event) { if(Constants.FINGERPRINT.equals("@FINGERPRINT@")) { Log.logger.error("No Fingerprint. Might not be a valid version!"); } } @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { //not needed, code already in init //logger = event.getModLog(); ConfigurationHandler.init(event.getSuggestedConfigurationFile()); ModBlocks.init(); ModItems.init(); proxy.registerKeyBindings();//Schematica proxy.registerEntities(); proxy.registerEntityRendering(); } @Mod.EventHandler public void init(FMLInitializationEvent event) { network = NetworkRegistry.INSTANCE.newSimpleChannel(Constants.MOD_NAME); // ColonyView messages getNetwork().registerMessage(ColonyViewMessage.class, ColonyViewMessage.class, 1, Side.CLIENT); getNetwork().registerMessage(ColonyViewCitizenViewMessage.class, ColonyViewCitizenViewMessage.class, 2, Side.CLIENT); getNetwork().registerMessage(ColonyViewRemoveCitizenMessage.class, ColonyViewRemoveCitizenMessage.class, 3, Side.CLIENT); getNetwork().registerMessage(ColonyViewBuildingViewMessage.class, ColonyViewBuildingViewMessage.class, 4, Side.CLIENT); getNetwork().registerMessage(ColonyViewRemoveBuildingMessage.class, ColonyViewRemoveBuildingMessage.class, 5, Side.CLIENT); getNetwork().registerMessage(PermissionsMessage.View.class, PermissionsMessage.View.class, 6, Side.CLIENT); getNetwork().registerMessage(ColonyStylesMessage.class, ColonyStylesMessage.class, 7, Side.CLIENT); // Permission Request messages getNetwork().registerMessage(PermissionsMessage.Permission.class, PermissionsMessage.Permission.class, 10, Side.SERVER); getNetwork().registerMessage(PermissionsMessage.AddPlayer.class, PermissionsMessage.AddPlayer.class, 11, Side.SERVER); getNetwork().registerMessage(PermissionsMessage.RemovePlayer.class, PermissionsMessage.RemovePlayer.class, 12, Side.SERVER); getNetwork().registerMessage(PermissionsMessage.SetPlayerRank.class, PermissionsMessage.SetPlayerRank.class, 13, Side.SERVER); // Colony Request messages getNetwork().registerMessage(BuildRequestMessage.class, BuildRequestMessage.class, 20, Side.SERVER); getNetwork().registerMessage(OpenInventoryMessage.class, OpenInventoryMessage.class, 21, Side.SERVER); getNetwork().registerMessage(TownHallRenameMessage.class, TownHallRenameMessage.class, 22, Side.SERVER); getNetwork().registerMessage(MinerSetLevelMessage.class, MinerSetLevelMessage.class, 23, Side.SERVER); getNetwork().registerMessage(FarmerCropTypeMessage.class, FarmerCropTypeMessage.class, 24, Side.SERVER); getNetwork().registerMessage(RecallCitizenMessage.class, RecallCitizenMessage.class, 25, Side.SERVER); getNetwork().registerMessage(BuildToolPlaceMessage.class, BuildToolPlaceMessage.class, 26, Side.SERVER); getNetwork().registerMessage(ToggleJobMessage.class, ToggleJobMessage.class, 27, Side.SERVER); getNetwork().registerMessage(HireFireMessage.class, HireFireMessage.class, 28, Side.SERVER); //Client side only getNetwork().registerMessage(BlockParticleEffectMessage.class, BlockParticleEffectMessage.class, 50, Side.CLIENT); proxy.registerTileEntities(); RecipeHandler.init(Configurations.enableInDevelopmentFeatures, Configurations.supplyChests); proxy.registerEvents(); proxy.registerTileEntityRendering(); proxy.registerRenderer(); Schematics.init(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { } /** * Returns whether the side is client or not * * @return True when client, otherwise false */ public static boolean isClient() { return proxy.isClient() && FMLCommonHandler.instance().getEffectiveSide().isClient(); } /** * Returns whether the side is client or not * * @return True when server, otherwise false */ public static boolean isServer() { return !proxy.isClient() && FMLCommonHandler.instance().getEffectiveSide().isServer(); } }
  4. ClientProxy package com.minecolonies.proxy; import com.minecolonies.blocks.ModBlocks; import com.minecolonies.client.gui.WindowBuildTool; import com.minecolonies.client.gui.WindowCitizen; import com.minecolonies.client.render.EmptyTileEntitySpecialRenderer; import com.minecolonies.client.render.RenderBipedCitizen; import com.minecolonies.client.render.RenderFishHook; import com.minecolonies.client.render.TileEntityScarecrowRenderer; import com.minecolonies.colony.CitizenData; import com.minecolonies.entity.EntityCitizen; import com.minecolonies.entity.EntityFishHook; import com.minecolonies.event.ClientEventHandler; import com.minecolonies.items.ModItems; import com.minecolonies.tileentities.ScarecrowTileEntity; import com.minecolonies.tileentities.TileEntityColonyBuilding; import com.schematica.client.events.TickHandler; import com.schematica.client.renderer.RendererSchematicGlobal; import com.schematica.world.SchematicWorld; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.BlockPos; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { private RendererSchematicGlobal rendererSchematicGlobal; private SchematicWorld schematicWorld = null; @Override public boolean isClient() { return true; } @Override public void registerKeyBindings() { // for(KeyBinding keyBinding : KeyInputHandler.KEY_BINDINGS) // { // ClientRegistry.registerKeyBinding(keyBinding); // } } @Override public void registerEvents() { super.registerEvents(); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); //Schematica MinecraftForge.EVENT_BUS.register(new TickHandler()); this.rendererSchematicGlobal = new RendererSchematicGlobal(); MinecraftForge.EVENT_BUS.register(this.rendererSchematicGlobal); } @Override public void registerEntityRendering() { RenderingRegistry.registerEntityRenderingHandler(EntityCitizen.class, RenderBipedCitizen::new); RenderingRegistry.registerEntityRenderingHandler(EntityFishHook.class, RenderFishHook::new); } @Override public void registerTileEntityRendering() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityColonyBuilding.class, new EmptyTileEntitySpecialRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(ScarecrowTileEntity.class, new TileEntityScarecrowRenderer()); } @Override public void showCitizenWindow(CitizenData.View citizen) { WindowCitizen window = new WindowCitizen(citizen); window.open(); } @Override public void openBuildToolWindow(BlockPos pos) { WindowBuildTool window = new WindowBuildTool(pos); window.open(); } //Schematica @Override public void setActiveSchematic(SchematicWorld world) { this.schematicWorld = world; } @Override public SchematicWorld getActiveSchematic() { return this.schematicWorld; } @Override public void registerRenderer() { super.registerRenderer(); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutBaker), 0, new ModelResourceLocation(ModBlocks.blockHutBaker.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutBlacksmith), 0, new ModelResourceLocation(ModBlocks.blockHutBlacksmith.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutBuilder), 0, new ModelResourceLocation(ModBlocks.blockHutBuilder.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutCitizen), 0, new ModelResourceLocation(ModBlocks.blockHutCitizen.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutFarmer), 0, new ModelResourceLocation(ModBlocks.blockHutFarmer.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutFisherman), 0, new ModelResourceLocation(ModBlocks.blockHutFisherman.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutLumberjack), 0, new ModelResourceLocation(ModBlocks.blockHutLumberjack.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutMiner), 0, new ModelResourceLocation(ModBlocks.blockHutMiner.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutStonemason), 0, new ModelResourceLocation(ModBlocks.blockHutStonemason.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutTownHall), 0, new ModelResourceLocation(ModBlocks.blockHutTownHall.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutWarehouse), 0, new ModelResourceLocation(ModBlocks.blockHutWarehouse.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockSubstitution), 0, new ModelResourceLocation(ModBlocks.blockSubstitution.getRegistryName(), "inventory")); //Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blockHutField), 0, new ModelResourceLocation(ModBlocks.blockHutField.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.buildTool, 0, new ModelResourceLocation(ModItems.buildTool.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.caliper, 0, new ModelResourceLocation(ModItems.caliper.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.scanTool, 0, new ModelResourceLocation(ModItems.scanTool.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.supplyChest, 0, new ModelResourceLocation(ModItems.supplyChest.getRegistryName(), "inventory")); ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.blockHutField), 0, ScarecrowTileEntity.class); } } Main class: package com.minecolonies; import com.minecolonies.blocks.ModBlocks; import com.minecolonies.colony.Schematics; import com.minecolonies.configuration.ConfigurationHandler; import com.minecolonies.configuration.Configurations; import com.minecolonies.items.ModItems; import com.minecolonies.lib.Constants; import com.minecolonies.network.messages.*; import com.minecolonies.proxy.IProxy; import com.minecolonies.util.Log; import com.minecolonies.util.RecipeHandler; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; @Mod(modid = Constants.MOD_ID, name = Constants.MOD_NAME, version = Constants.VERSION, certificateFingerprint = Constants.FINGERPRINT, dependencies = Constants.FORGE_VERSION, acceptedMinecraftVersions = Constants.MC_VERSION) public class MineColonies { private static SimpleNetworkWrapper network; @Mod.Instance(Constants.MOD_ID) public static MineColonies instance; @SidedProxy(clientSide = Constants.CLIENT_PROXY_LOCATION, serverSide = Constants.SERVER_PROXY_LOCATION) public static IProxy proxy; public static SimpleNetworkWrapper getNetwork() { return network; } @Mod.EventHandler public void invalidFingerprint(FMLFingerprintViolationEvent event) { if(Constants.FINGERPRINT.equals("@FINGERPRINT@")) { Log.logger.error("No Fingerprint. Might not be a valid version!"); } } @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { //not needed, code already in init //logger = event.getModLog(); ConfigurationHandler.init(event.getSuggestedConfigurationFile()); ModBlocks.init(); ModItems.init(); proxy.registerKeyBindings();//Schematica proxy.registerEntities(); proxy.registerEntityRendering(); } @Mod.EventHandler public void init(FMLInitializationEvent event) { network = NetworkRegistry.INSTANCE.newSimpleChannel(Constants.MOD_NAME); // ColonyView messages getNetwork().registerMessage(ColonyViewMessage.class, ColonyViewMessage.class, 1, Side.CLIENT); getNetwork().registerMessage(ColonyViewCitizenViewMessage.class, ColonyViewCitizenViewMessage.class, 2, Side.CLIENT); getNetwork().registerMessage(ColonyViewRemoveCitizenMessage.class, ColonyViewRemoveCitizenMessage.class, 3, Side.CLIENT); getNetwork().registerMessage(ColonyViewBuildingViewMessage.class, ColonyViewBuildingViewMessage.class, 4, Side.CLIENT); getNetwork().registerMessage(ColonyViewRemoveBuildingMessage.class, ColonyViewRemoveBuildingMessage.class, 5, Side.CLIENT); getNetwork().registerMessage(PermissionsMessage.View.class, PermissionsMessage.View.class, 6, Side.CLIENT); getNetwork().registerMessage(ColonyStylesMessage.class, ColonyStylesMessage.class, 7, Side.CLIENT); // Permission Request messages getNetwork().registerMessage(PermissionsMessage.Permission.class, PermissionsMessage.Permission.class, 10, Side.SERVER); getNetwork().registerMessage(PermissionsMessage.AddPlayer.class, PermissionsMessage.AddPlayer.class, 11, Side.SERVER); getNetwork().registerMessage(PermissionsMessage.RemovePlayer.class, PermissionsMessage.RemovePlayer.class, 12, Side.SERVER); getNetwork().registerMessage(PermissionsMessage.SetPlayerRank.class, PermissionsMessage.SetPlayerRank.class, 13, Side.SERVER); // Colony Request messages getNetwork().registerMessage(BuildRequestMessage.class, BuildRequestMessage.class, 20, Side.SERVER); getNetwork().registerMessage(OpenInventoryMessage.class, OpenInventoryMessage.class, 21, Side.SERVER); getNetwork().registerMessage(TownHallRenameMessage.class, TownHallRenameMessage.class, 22, Side.SERVER); getNetwork().registerMessage(MinerSetLevelMessage.class, MinerSetLevelMessage.class, 23, Side.SERVER); getNetwork().registerMessage(FarmerCropTypeMessage.class, FarmerCropTypeMessage.class, 24, Side.SERVER); getNetwork().registerMessage(RecallCitizenMessage.class, RecallCitizenMessage.class, 25, Side.SERVER); getNetwork().registerMessage(BuildToolPlaceMessage.class, BuildToolPlaceMessage.class, 26, Side.SERVER); getNetwork().registerMessage(ToggleJobMessage.class, ToggleJobMessage.class, 27, Side.SERVER); getNetwork().registerMessage(HireFireMessage.class, HireFireMessage.class, 28, Side.SERVER); //Client side only getNetwork().registerMessage(BlockParticleEffectMessage.class, BlockParticleEffectMessage.class, 50, Side.CLIENT); proxy.registerTileEntities(); RecipeHandler.init(Configurations.enableInDevelopmentFeatures, Configurations.supplyChests); proxy.registerEvents(); proxy.registerTileEntityRendering(); proxy.registerRenderer(); Schematics.init(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { } /** * Returns whether the side is client or not * * @return True when client, otherwise false */ public static boolean isClient() { return proxy.isClient() && FMLCommonHandler.instance().getEffectiveSide().isClient(); } /** * Returns whether the side is client or not * * @return True when server, otherwise false */ public static boolean isServer() { return !proxy.isClient() && FMLCommonHandler.instance().getEffectiveSide().isServer(); } }
  5. No, it seems not to be. And ingame in the world the texture isn't rendered, so all is black.
  6. No, it seems not to be. And ingame in the world the texture isn't rendered, so all is black.
  7. Hm.... it does not crash.... So how do I have to fix this up? I mean the textures aren't working ingame, too.
  8. Hm.... it does not crash.... So how do I have to fix this up? I mean the textures aren't working ingame, too.
  9. package com.minecolonies.client.render; import com.minecolonies.blocks.BlockHutField; import com.minecolonies.client.model.ModelScarecrowBoth; import com.minecolonies.lib.Constants; import com.minecolonies.tileentities.ScarecrowTileEntity; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; /** * Class to render the scarecrow. */ @SideOnly(Side.CLIENT) public class TileEntityScarecrowRenderer extends TileEntitySpecialRenderer<ScarecrowTileEntity> { private final ModelScarecrowBoth model; public TileEntityScarecrowRenderer() { this.model = new ModelScarecrowBoth(); } @Override public void renderTileEntityAt(ScarecrowTileEntity te, double posX, double posY, double posZ, float partialTicks, int destroyStage) { GlStateManager.pushMatrix(); // store the transformation GlStateManager.translate(posX, posY, posZ); // set viewport to tile entity position to render it /* ============ Rendering Code goes here ============ */ EnumFacing facing = te.getWorld().getBlockState(te.getPos()).getValue(BlockHutField.FACING); this.bindTexture(this.getResourceLocation(te)); //GlStateManager.rotate(angle, x, y, z); this.model.render(.0625f); /* ============ Rendering Code stops here =========== */ GlStateManager.popMatrix(); // restore the transformation, so other renderer's are not messed up } private ResourceLocation getResourceLocation(ScarecrowTileEntity tileentity) { String loc; if(tileentity.getType()) loc = "textures/blocks/blockScarecrowPumpkin.png"; else loc = "textures/blocks/blockScarecrowNormal.png"; return new ResourceLocation(Constants.MOD_ID + ":" + loc); } } Also, the texture seems also not to be loaded.... ClientRegistry.bindTileEntitySpecialRenderer(ScarecrowTileEntity.class, new TileEntityScarecrowRenderer()); ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.blockHutField), 0, ScarecrowTileEntity.class); This is in Client Proxy.
  10. package com.minecolonies.client.render; import com.minecolonies.blocks.BlockHutField; import com.minecolonies.client.model.ModelScarecrowBoth; import com.minecolonies.lib.Constants; import com.minecolonies.tileentities.ScarecrowTileEntity; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; /** * Class to render the scarecrow. */ @SideOnly(Side.CLIENT) public class TileEntityScarecrowRenderer extends TileEntitySpecialRenderer<ScarecrowTileEntity> { private final ModelScarecrowBoth model; public TileEntityScarecrowRenderer() { this.model = new ModelScarecrowBoth(); } @Override public void renderTileEntityAt(ScarecrowTileEntity te, double posX, double posY, double posZ, float partialTicks, int destroyStage) { GlStateManager.pushMatrix(); // store the transformation GlStateManager.translate(posX, posY, posZ); // set viewport to tile entity position to render it /* ============ Rendering Code goes here ============ */ EnumFacing facing = te.getWorld().getBlockState(te.getPos()).getValue(BlockHutField.FACING); this.bindTexture(this.getResourceLocation(te)); //GlStateManager.rotate(angle, x, y, z); this.model.render(.0625f); /* ============ Rendering Code stops here =========== */ GlStateManager.popMatrix(); // restore the transformation, so other renderer's are not messed up } private ResourceLocation getResourceLocation(ScarecrowTileEntity tileentity) { String loc; if(tileentity.getType()) loc = "textures/blocks/blockScarecrowPumpkin.png"; else loc = "textures/blocks/blockScarecrowNormal.png"; return new ResourceLocation(Constants.MOD_ID + ":" + loc); } } Also, the texture seems also not to be loaded.... ClientRegistry.bindTileEntitySpecialRenderer(ScarecrowTileEntity.class, new TileEntityScarecrowRenderer()); ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.blockHutField), 0, ScarecrowTileEntity.class); This is in Client Proxy.
  11. EDIT: So why isn't it showing me the block in the inventory yet when I'm using registerTESRItemStack ?
  12. EDIT: So why isn't it showing me the block in the inventory yet when I'm using registerTESRItemStack ?
  13. Ah, ok. @diesieben07 It's a TESR because the team I'm working with want's it so and they got only the java code for the model from their modeller. ForgeHooksClient.registerTESRItemStack is deprecated. Is there a replacement for it, because I don't like deprecated stuff. EnumFacing facing = te.getWorld().getBlockState(te.getPos()).getValue(BlockHutField.FACING); this.bindTexture(this.getResourceLocation(te)); GlStateManager.rotate(angle, x, y, z); this.model.render(.0625f); What do I have to put in there now, so in the GlStateManager.rotate method? Just to mention, the complete model must also always be rotated around 180 degrees cause it's up side down. EDIT: Ok, I've got now jsons because I render it with the rendering class. I've got also that code ForgeHooksClient#registerTESRItemStack as a replacement for the json loading stuff and now it's not drawing in the inventory.
  14. Ah, ok. @diesieben07 It's a TESR because the team I'm working with want's it so and they got only the java code for the model from their modeller. ForgeHooksClient.registerTESRItemStack is deprecated. Is there a replacement for it, because I don't like deprecated stuff. EnumFacing facing = te.getWorld().getBlockState(te.getPos()).getValue(BlockHutField.FACING); this.bindTexture(this.getResourceLocation(te)); GlStateManager.rotate(angle, x, y, z); this.model.render(.0625f); What do I have to put in there now, so in the GlStateManager.rotate method? Just to mention, the complete model must also always be rotated around 180 degrees cause it's up side down. EDIT: Ok, I've got now jsons because I render it with the rendering class. I've got also that code ForgeHooksClient#registerTESRItemStack as a replacement for the json loading stuff and now it's not drawing in the inventory.
  15. Ok, I've got now this done: task incrementBuildNumber() { dependsOn "reobf" So now I have to call this task, correct? And you've got there the task releaseJars(type: Copy) { method. Doesn't this need also to be called? from incrementBuildNumber from nameOfJarTask Why from nameOfJarTask when I've got the task incrementBuildNumber which is already above the line?
  16. Ok, I've got now this done: task incrementBuildNumber() { dependsOn "reobf" So now I have to call this task, correct? And you've got there the task releaseJars(type: Copy) { method. Doesn't this need also to be called? from incrementBuildNumber from nameOfJarTask Why from nameOfJarTask when I've got the task incrementBuildNumber which is already above the line?
  17. For addons you don't need the source code. The API should be enough. Then add the dependencies tag to your @Mod annotation and tell Forge that those mods are required to run.
  18. For addons you don't need the source code. The API should be enough. Then add the dependencies tag to your @Mod annotation and tell Forge that those mods are required to run.
  19. glRotate . ForgeHooksClient.registerTESRItemStack . Why is this is a TESR though? What is a TESR? And when I have glRotate, I have to get somehow the rotations from the block itself which where set with a PropertyDirection in the block class. EDIT: When I've got ForgeHooksClient.registerTESRItemStack, do I need any json file? And if I need them, what to put in them?
  20. glRotate . ForgeHooksClient.registerTESRItemStack . Why is this is a TESR though? What is a TESR? And when I have glRotate, I have to get somehow the rotations from the block itself which where set with a PropertyDirection in the block class. EDIT: When I've got ForgeHooksClient.registerTESRItemStack, do I need any json file? And if I need them, what to put in them?
  21. Hi, I've got some problems: How can I tell Minecraft to use the block rotations while rendering and how can I tell it to render also the custom model in my inventory? Model code: Render code: I also hope it's correct how I try getting the texture. Not quite sure about this. Thx in advance. Bektor
  22. Hi, I've got some problems: How can I tell Minecraft to use the block rotations while rendering and how can I tell it to render also the custom model in my inventory? Model code: Render code: I also hope it's correct how I try getting the texture. Not quite sure about this. Thx in advance. Bektor
  23. There is just one problem. A boolean is NEVER null. If it has no value, it gets assigned I think true.
×
×
  • Create New...

Important Information

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