diff --git a/build.gradle b/build.gradle index 9f80e19..634a488 100644 --- a/build.gradle +++ b/build.gradle @@ -62,8 +62,8 @@ minecraft { runDir = "eclipse" mappings = "stable_39" - //mappings = "snapshot_20171003" - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + //mappings = "snapshot_20180814" + makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } dependencies { @@ -129,4 +129,4 @@ processResources { from(sourceSets.main.resources.srcDirs) { exclude "mcmod.info" } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 1ce801c..d1308a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,6 @@ # This is required to provide enough memory for the Minecraft decompilation process. baseVersion=1.0 minecraftVersion=1.12.2 -forgeVersion=14.23.5.2838 +forgeVersion=14.23.5.2847 org.gradle.jvmargs=-Xmx4G diff --git a/models/ModelPhotonCollector.bbmodel b/models/ModelPhotonCollector.bbmodel new file mode 100644 index 0000000..a78de8e --- /dev/null +++ b/models/ModelPhotonCollector.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"3.0","model_format":"modded_entity","box_uv":true},"name":"ModelPhotonCollector","geo_name":"ModelPhotonCollector","resolution":{"width":128,"height":128},"elements":[{"name":"base_1","from":[-7,1,-7],"to":[7,7,7],"autouv":0,"color":4,"origin":[0,0,0],"uv_offset":[0,18],"uuid":"bfce34df-0316-50c2-904e-138f876fbf5a"},{"name":"base_2","from":[-8,0,-8],"to":[8,2,8],"autouv":0,"color":4,"origin":[0,1,0],"uuid":"255ffd28-61bd-9f13-a28e-20a08b0ac38b"},{"name":"cuve_1","from":[-5,7,-7],"to":[7,10,-5],"autouv":0,"color":4,"origin":[0,0,0],"uv_offset":[48,0],"uuid":"bde74bc6-7320-894b-977c-352aaebb4d33"},{"name":"core_1","from":[-5,15,-5],"to":[5,20,5],"autouv":0,"color":3,"origin":[0,12.916666666666664,0],"uv_offset":[0,38],"uuid":"ae1a6b43-b04a-ec62-84fa-55654138e1f9"},{"name":"cube","from":[-2,7,-2],"to":[2,15,2],"autouv":0,"color":6,"origin":[0,12.916666666666664,0],"uuid":"3eb4fb91-a6de-59ba-635e-8f4067c53847"},{"name":"fiber_1","from":[2,7,2],"to":[4,15,4],"autouv":0,"color":0,"origin":[0,12.916666666666664,0],"uv_offset":[0,38],"uuid":"d850505d-ee51-b115-e755-a4efde95bd14"},{"name":"fiber_2","from":[2,7,-4],"to":[4,15,-2],"autouv":0,"color":0,"origin":[0,12.916666666666664,0],"uv_offset":[0,38],"uuid":"f5e34021-824c-a8bb-b2f7-40c754376d4d"},{"name":"fiber_3","from":[-4,7,-4],"to":[-2,15,-2],"autouv":0,"color":0,"origin":[0,12.916666666666664,0],"uv_offset":[0,38],"uuid":"27206058-3332-ec8b-dd7e-60ca2a3d42e0"},{"name":"fiber_4","from":[-4,7,2],"to":[-2,15,4],"autouv":0,"color":0,"origin":[0,12.916666666666664,0],"uv_offset":[0,38],"uuid":"5a213ddf-301e-05b1-5756-a4a3b68119fd"},{"name":"core_2","from":[-3,20,-3],"to":[3,21,3],"autouv":0,"color":7,"origin":[0,12.916666666666664,0],"uv_offset":[30,38],"uuid":"202eb30a-4e6d-d327-9027-5f3a7d098f01"},{"name":"core_3","from":[-2,21,-3],"to":[2,23,3],"autouv":0,"color":7,"origin":[0,12.916666666666664,0],"uv_offset":[40,45],"uuid":"092fe0e7-3594-d385-a7cd-36a9def1f99c"},{"name":"core_4","from":[1.4999999999999996,20.799999999999997,-3],"to":[2.4999999999999996,22.799999999999997,3],"autouv":0,"color":7,"origin":[0,12.916666666666664,0],"uv_offset":[0,18],"uuid":"b7d55b18-878d-5d94-eb8c-0838b2927604"},{"name":"core_5","from":[-2.4999999999999996,21,-3],"to":[-1.5,23,3],"autouv":0,"color":7,"origin":[-2.5,22,0],"uv_offset":[0,18],"uuid":"487f1219-ace5-abc0-226a-5e07608fdecc"},{"name":"shaft","from":[-1,20.353553390593273,-11],"to":[1,22.353553390593273,11],"autouv":0,"color":0,"origin":[0,10.5,0],"uv_offset":[0,53],"uuid":"1dc0b124-54ec-ac7d-6056-f2602a692a10"},{"name":"panel_1_1","from":[-0.5000000000000001,14.899999999999913,-11.500000000000002],"to":[0.4999999999999999,27.899999999999913,-6.500000000000002],"autouv":0,"color":1,"origin":[-3.2855339059327386,25.34619407771256,-11.5],"uv_offset":[0,77],"uuid":"7482df0e-483b-a701-d21b-c7ef91e57efe"},{"name":"penel_1_2","from":[0.49999999999999956,14.399999999999906,-12],"to":[1.4999999999999996,28.399999999999906,-6],"autouv":0,"color":1,"origin":[-3.2855339059327386,25.34619407771256,-11.5],"uv_offset":[0,53],"uuid":"1bdd4b75-808f-2d04-1616-8f1131ea3091"},{"name":"panel_2_1","from":[-0.5000000000000001,14.899999999999913,6.499999999999998],"to":[0.4999999999999999,27.899999999999913,11.499999999999998],"autouv":0,"color":1,"origin":[-3.2855339059327386,25.34619407771256,-11.5],"uv_offset":[0,77],"uuid":"111209e1-1903-e3b5-7e01-d69f3a685c4e"},{"name":"panel_2_2","from":[0.49999999999999956,14.399999999999906,6],"to":[1.4999999999999996,28.399999999999906,12],"autouv":0,"color":1,"origin":[-3.2855339059327386,25.34619407771256,-11.5],"uv_offset":[0,53],"uuid":"db9f7bb7-36cc-6074-aa5c-55a7652ef5dd"},{"name":"cuve_2","from":[-7,7,5],"to":[5,10,7],"autouv":0,"color":4,"origin":[0,0,0],"uv_offset":[48,0],"uuid":"81c073a5-5c8a-ff86-c553-7897324f824b"},{"name":"cuve_3","from":[-5,7,-7],"to":[7,10,-5],"autouv":0,"color":4,"origin":[0,0,0],"uv_offset":[48,0],"uuid":"56f7fac4-d49e-3e7c-b926-6a9024a90600"},{"name":"cuve_4","from":[-7,7,5],"to":[5,10,7],"autouv":0,"color":4,"origin":[0,0,0],"uv_offset":[48,0],"uuid":"48c83cd8-adc2-57cd-26eb-b938a54b479a"}],"outliner":[{"name":"base","uuid":"27eeec61-35d6-b3b2-5d8d-bc01e674467e","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,0,0],"children":["bfce34df-0316-50c2-904e-138f876fbf5a","255ffd28-61bd-9f13-a28e-20a08b0ac38b",{"name":"cuve","uuid":"14bd6bb1-d813-2469-a2fd-5b7603c51d3d","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,0,0],"children":[{"name":"x","uuid":"5d569b6b-1c82-0783-2424-cfe7805de8bd","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,8.5,0],"children":["bde74bc6-7320-894b-977c-352aaebb4d33","81c073a5-5c8a-ff86-c553-7897324f824b"]},{"name":"y","uuid":"1de9085b-81df-54ab-740b-26cdf213b7af","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,8.5,0],"rotation":[0,90,0],"children":["56f7fac4-d49e-3e7c-b926-6a9024a90600","48c83cd8-adc2-57cd-26eb-b938a54b479a"]}]},{"name":"catalyser","uuid":"8bece1e2-1dd5-3a11-0128-420ec2b8ee6c","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,10.5,0],"children":["ae1a6b43-b04a-ec62-84fa-55654138e1f9","202eb30a-4e6d-d327-9027-5f3a7d098f01","092fe0e7-3594-d385-a7cd-36a9def1f99c",{"name":"capa","uuid":"8048b777-0cec-e572-c14a-b4e9d05a5711","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,12.5,0],"rotation":[0,45,0],"children":["3eb4fb91-a6de-59ba-635e-8f4067c53847"]},"d850505d-ee51-b115-e755-a4efde95bd14","f5e34021-824c-a8bb-b2f7-40c754376d4d","27206058-3332-ec8b-dd7e-60ca2a3d42e0","5a213ddf-301e-05b1-5756-a4a3b68119fd",{"name":"core_4","uuid":"3ecd4282-4d60-83ae-0a87-922c4cc040f7","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[2,22,0],"rotation":[0,0,-25],"children":["b7d55b18-878d-5d94-eb8c-0838b2927604"]},{"name":"core_5","uuid":"b3119d69-9932-8b0d-17c0-56cdf5292ebe","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[-2.5,22,0],"rotation":[0,0,25],"children":["487f1219-ace5-abc0-226a-5e07608fdecc"]},{"name":"collector","uuid":"1edc2ac6-0578-ad7d-2d17-ba27f7072e9f","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,21.353553390593273,0],"rotation":[0,0,-45],"children":["1dc0b124-54ec-ac7d-6056-f2602a692a10",{"name":"panel_1","uuid":"082687f6-7410-d4ef-5f26-c8a4724248a4","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0.4999999999999997,21.39999999999991,-9],"children":["7482df0e-483b-a701-d21b-c7ef91e57efe","1bdd4b75-808f-2d04-1616-8f1131ea3091"]},{"name":"panel_2","uuid":"ecad9651-7fd3-1cfd-0c4a-756edcbc5457","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0.4999999999999997,21.39999999999991,9],"children":["111209e1-1903-e3b5-7e01-d69f3a685c4e","db9f7bb7-36cc-6074-aa5c-55a7652ef5dd"]}]}]}]}],"textures":[{"path":"D:\\JCS\\Bureau\\ModelPhotonCollector.png","name":"ModelPhotonCollector.png","folder":"Bureau","namespace":"","id":"1","particle":false,"mode":"link","saved":true,"uuid":"366e25e7-5fae-a0e1-2d3e-7259a92b9443"}]} \ No newline at end of file diff --git a/ob/blocks/PhotonAcceleratorBlock.java b/ob/blocks/PhotonAcceleratorBlock.java deleted file mode 100644 index 2a77a91..0000000 --- a/ob/blocks/PhotonAcceleratorBlock.java +++ /dev/null @@ -1,130 +0,0 @@ -package fr.jackcartersmith.ob.blocks; - -import java.util.Random; - -import fr.jackcartersmith.ob.proxy.ClientProxy; -import fr.jackcartersmith.orbsat.OrbitalSatellite; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class PhotonAcceleratorBlock extends BlockContainer -{ - public PhotonAcceleratorBlock(Material par2Material) - { - super(Material.iron); - } - - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) - { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); - } - - /** - * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata - */ - public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) - { - return super.onBlockPlaced(par1World, par2, par3, par4, par5, par6, par7, par8, par9); - } - - /** - * Called upon block activation (right click on the block.) - */ - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c) - { - PhotonAcceleratorTileEntity entity = (PhotonAcceleratorTileEntity)world.getTileEntity(x, y, z); - - if (!player.isSneaking()) - { - OrbitalSatellite.instance.lastGeneralX = x; - OrbitalSatellite.instance.lastGeneralY = y; - OrbitalSatellite.instance.lastGeneralZ = z; - player.openGui(OrbitalSatellite.instance, 4, world, (int)player.posX, (int)player.posY, (int)player.posZ); - } - - return true; - } - - /** - * A randomly called display update to be able to add particles or other items for display - */ - public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) - { - PhotonAcceleratorTileEntity entity = (PhotonAcceleratorTileEntity)par1World.getTileEntity(par2, par3, par4); - - if (entity.getOutputRate() > 0) - { - this.setLightLevel(1.0F); - par1World.markBlockForUpdate(par2, par3, par4); - float f1 = (float)par2 + 0.5F; - float f2 = (float)par3 + 1.0F; - float f3 = (float)par4 + 0.5F; - - for (int i = 0; i <= 2; ++i) - { - par1World.spawnParticle("reddust", (double)f1 + par5Random.nextDouble() + 0.3D - 0.8D, (double)f2 + par5Random.nextDouble() + 0.3D - 0.8D + 1.0D, (double)f3 + par5Random.nextDouble() + 0.3D - 0.8D, 1.0D, 1.0D, 2.0D); - } - } - else - { - this.setLightLevel(0.0F); - par1World.markBlockForUpdate(par2, par3, par4); - } - } - - /** - * Returns a new instance of a block's tile entity class. Called on placing the block. - */ - @Override - public TileEntity createNewTileEntity(World arg0, int arg1) - { - return new PhotonAcceleratorTileEntity(); - } - @Override - public boolean hasTileEntity(int metadata) - { - return true; - } - - /** - * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a - * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old - * metadata - */ - public void breakBlock(World par1World, int par2, int par3, int par4, Block block, int par6) - { - par1World.removeTileEntity(par2, par3, par4); - par1World.removeTileEntity(par2, par3 + 1, par4); - par1World.setBlockToAir(par2, par3 + 1, par4); - } - - /** - * The type of render function that is called for this block - */ - public int getRenderType() - { - return ClientProxy.tesrRenderId; - } - - /** - * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two - * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. - */ - public boolean isOpaqueCube() - { - return false; - } - - /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) - */ - public boolean renderAsNormalBlock() - { - return false; - } -} diff --git a/ob/models/ModelDefenderLaserEvo.java b/ob/models/ModelDefenderLaserEvo.java deleted file mode 100644 index 9669ead..0000000 --- a/ob/models/ModelDefenderLaserEvo.java +++ /dev/null @@ -1,61 +0,0 @@ -package fr.jackcartersmith.ob.models; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.entity.Entity; -import org.lwjgl.opengl.GL11; - -/** - * ModelDefenderLaserLow - JackCarterSmith - * Created using Tabula 4.1.1 - */ -public class ModelDefenderLaserEvo extends ModelBase { - public ModelRenderer l1; - public ModelRenderer l2; - - public ModelDefenderLaserEvo() { - this.textureWidth = 16; - this.textureHeight = 32; - this.l1 = new ModelRenderer(this, 0, 0); - this.l1.setRotationPoint(0.0F, 8.0F, 0.0F); - this.l1.addBox(-2.5F, -19000.0F, -2.5F, 5, 10000, 5, 0.0F); - this.l2 = new ModelRenderer(this, 0, 0); - this.l2.setRotationPoint(0.0F, 8.0F, 0.0F); - this.l2.addBox(-2.5F, -19000.0F, -2.5F, 5, 20000, 5, 0.0F); - this.setRotateAngle(l2, 0.0F, 0.7853981633974483F, 0.0F); - } - - @Override - public void render(Entity entity, float embitterRotation, float brightness, float f2, float f3, float f4, float scale) { - float lastBrightnessX = OpenGlHelper.lastBrightnessX; - float lastBrightnessY = OpenGlHelper.lastBrightnessY; - - float b = brightness * 200F; - float colour_r = Math.min(2F, (brightness * 1F) + 0.1F); - float colour_g = Math.min(2F, (brightness * 0F) + 0.1F); - float colour_b = Math.min(2F, (brightness * 2F) + 0.1F); - - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); - GL11.glColor4f(colour_r, colour_g, colour_b, 0.75F); - if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING); - - this.l1.render(scale); - - if (brightness > 0F) GL11.glEnable(GL11.GL_LIGHTING); - GL11.glColor4f(1F, 1F, 1F, 1F); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); - GL11.glEnable(GL11.GL_LIGHTING); - - this.l2.render(scale); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } -} diff --git a/src/main/java/jackcartersmith/orbsat/OrbitalSatellite.java b/src/main/java/jackcartersmith/orbsat/OrbitalSatellite.java index 2bd6413..f2710da 100644 --- a/src/main/java/jackcartersmith/orbsat/OrbitalSatellite.java +++ b/src/main/java/jackcartersmith/orbsat/OrbitalSatellite.java @@ -1,33 +1,14 @@ package jackcartersmith.orbsat; -import jackcartersmith.orbsat.common.util.ConfigManager; -import jackcartersmith.orbsat.common.CommonProxy; -import jackcartersmith.orbsat.common.EventHandler; -import jackcartersmith.orbsat.common.OrbsatContents; -import jackcartersmith.orbsat.common.OrbsatSaveData; -import jackcartersmith.orbsat.common.commands.CommandHandler; -import jackcartersmith.orbsat.common.compat.OrbsatCompatModule; -import jackcartersmith.orbsat.common.util.LogHelper; -import jackcartersmith.orbsat.common.util.network.MessageRequestBlockUpdate; -import jackcartersmith.orbsat.common.util.network.MessageTileSync; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -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.FMLLoadCompleteEvent; import net.minecraftforge.fml.common.event.FMLModIdMappingEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStartedEvent; -import net.minecraftforge.fml.common.event.FMLServerStartingEvent; -import net.minecraftforge.fml.common.network.NetworkRegistry; -import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import net.minecraftforge.fml.relauncher.Side; @Mod(modid = OrbitalSatellite.MODID, name = OrbitalSatellite.NAME, version = OrbitalSatellite.VERSION, modLanguage = "java", certificateFingerprint = "30f9f06606e9ab799c59ec743cab264c8310531d", dependencies = "required-after:forge@[14.23.5.2838,)") @@ -85,12 +66,15 @@ public class OrbitalSatellite { proxy.postInitEnd(); } + /* @Mod.EventHandler public void loadComplete(FMLLoadCompleteEvent event) { OrbsatCompatModule.doModulesLoadComplete(); } + */ + /* @Mod.EventHandler public void serverStarting(FMLServerStartingEvent event) { @@ -108,11 +92,10 @@ public class OrbitalSatellite { { LogHelper.info("WorldData loading"); - /* //Clear out any info from previous worlds - for(int dim : ImmersiveNetHandler.INSTANCE.getRelevantDimensions()) - ImmersiveNetHandler.INSTANCE.clearAllConnections(dim); - */ + //for(int dim : ImmersiveNetHandler.INSTANCE.getRelevantDimensions()) + // ImmersiveNetHandler.INSTANCE.clearAllConnections(dim); + OrbsatSaveData worldData = (OrbsatSaveData)world.loadData(OrbsatSaveData.class, OrbsatSaveData.dataName); if(worldData==null) @@ -127,6 +110,7 @@ public class OrbitalSatellite { } } } + */ @Mod.EventHandler public void modIDMapping(FMLModIdMappingEvent event) {} @@ -150,6 +134,7 @@ public class OrbitalSatellite { @Mod.EventHandler public void wrongSignature(FMLFingerprintViolationEvent event) { - System.out.println("[OrbSat/Error] THIS IS NOT AN OFFICIAL BUILD OF ORBITAL SATELLITE! Found these fingerprints: "+event.getFingerprints()); + if (!event.isDirectory()) + System.out.println("[ORBSAT][CAUTION] THIS IS NOT AN OFFICIAL BUILD OF ORBITAL SATELLITE! Unvalid file " + event.getSource().getName()); } } diff --git a/src/main/java/jackcartersmith/orbsat/client/ClientProxy.java b/src/main/java/jackcartersmith/orbsat/client/ClientProxy.java deleted file mode 100644 index 994553d..0000000 --- a/src/main/java/jackcartersmith/orbsat/client/ClientProxy.java +++ /dev/null @@ -1,10 +0,0 @@ -package jackcartersmith.orbsat.client; - -import jackcartersmith.orbsat.common.CommonProxy; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.relauncher.Side; - -@Mod.EventBusSubscriber(Side.CLIENT) -public class ClientProxy extends CommonProxy{ - //public static IEItemFontRender itemFont; -} diff --git a/src/main/java/jackcartersmith/orbsat/client/ClientUtils.java b/src/main/java/jackcartersmith/orbsat/client/ClientUtils.java deleted file mode 100644 index 5fa8b8b..0000000 --- a/src/main/java/jackcartersmith/orbsat/client/ClientUtils.java +++ /dev/null @@ -1,181 +0,0 @@ -package jackcartersmith.orbsat.client; - -import java.util.ArrayList; -import java.util.HashMap; - -import jackcartersmith.orbsat.common.util.Lib; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelBox; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumHandSide; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Timer; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.text.TextFormatting; - -public class ClientUtils { - public static final AxisAlignedBB standardBlockAABB = new AxisAlignedBB(0, 0, 0, 1, 1, 1); - static HashMap resourceMap = new HashMap(); - public static TextureAtlasSprite[] destroyBlockIcons = new TextureAtlasSprite[10]; - - public static Tessellator tes() - { - return Tessellator.getInstance(); - } - - public static Minecraft mc() - { - return Minecraft.getMinecraft(); - } - - public static void bindTexture(String path) - { - mc().getTextureManager().bindTexture(getResource(path)); - } - - public static void bindAtlas() - { - mc().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - } - - public static ResourceLocation getResource(String path) - { - ResourceLocation rl = resourceMap.containsKey(path)?resourceMap.get(path): new ResourceLocation(path); - if(!resourceMap.containsKey(path)) - resourceMap.put(path, rl); - return rl; - } - - public static TextureAtlasSprite getSprite(ResourceLocation rl) - { - return mc().getTextureMapBlocks().getAtlasSprite(rl.toString()); - } - - public static FontRenderer font() - { - return mc().fontRenderer; - } - - public static Timer timer() - { - return mc().timer; - } - - public enum TimestampFormat - { - D, - H, - M, - S, - MS, - HMS, - HM, - DHMS, - DHM, - DH; - static TimestampFormat[] coreValues = {TimestampFormat.D, TimestampFormat.H, TimestampFormat.M, TimestampFormat.S}; - - public boolean containsFormat(TimestampFormat format) - { - return this.toString().contains(format.toString()); - } - - public long getTickCut() - { - return this==D?1728000L: this==H?72000L: this==M?1200L: this==S?20L: 1; - } - - public String getLocalKey() - { - return this==D?"day": this==H?"hour": this==M?"minute": this==S?"second": ""; - } - } - - public static String fomatTimestamp(long timestamp, TimestampFormat format) - { - String s = ""; - for(TimestampFormat core : TimestampFormat.coreValues) - if(format.containsFormat(core)&×tamp >= core.getTickCut()) - { - s += I18n.format(Lib.DESC_INFO+core.getLocalKey(), Long.toString(timestamp/core.getTickCut())); - timestamp %= core.getTickCut(); - } - if(s.isEmpty()) - for(int i = TimestampFormat.coreValues.length-1; i >= 0; i--) - if(format.containsFormat(TimestampFormat.coreValues[i])) - { - s = I18n.format(Lib.DESC_INFO+TimestampFormat.coreValues[i].getLocalKey(), 0); - break; - } - return s; - } - - static int[] chatColours = { - 0x000000,//BLACK - 0x0000AA,//DARK_BLUE - 0x00AA00,//DARK_GREEN - 0x00AAAA,//DARK_AQUA - 0xAA0000,//DARK_RED - 0xAA00AA,//DARK_PURPLE - 0xFFAA00,//GOLD - 0xAAAAAA,//GRAY - 0x555555,//DARK_GRAY - 0x5555FF,//BLUE - 0x55FF55,//GREEN - 0x55FFFF,//AQUA - 0xFF5555,//RED - 0xFF55FF,//LIGHT_PURPLE - 0xFFFF55,//YELLOW - 0xFFFFFF//WHITE - }; - - public static int getFormattingColour(TextFormatting color) - { - return color.ordinal() < 16?chatColours[color.ordinal()]: 0; - } - - public static int getDarkenedTextColour(int colour) - { - int r = (colour >> 16&255)/4; - int g = (colour >> 8&255)/4; - int b = (colour&255)/4; - return r<<16|g<<8|b; - } - - public static ModelRenderer[] copyModelRenderers(ModelBase model, ModelRenderer... oldRenderers) - { - ModelRenderer[] newRenderers = new ModelRenderer[oldRenderers.length]; - for(int i = 0; i < newRenderers.length; i++) - if(oldRenderers[i]!=null) - { - newRenderers[i] = new ModelRenderer(model, oldRenderers[i].boxName); - int toX = oldRenderers[i].textureOffsetX; - int toY = oldRenderers[i].textureOffsetY; - newRenderers[i].setTextureOffset(toX, toY); - newRenderers[i].mirror = oldRenderers[i].mirror; - ArrayList newCubes = new ArrayList(); - for(ModelBox cube : oldRenderers[i].cubeList) - newCubes.add(new ModelBox(newRenderers[i], toX, toY, cube.posX1, cube.posY1, cube.posZ1, (int)(cube.posX2-cube.posX1), (int)(cube.posY2-cube.posY1), (int)(cube.posZ2-cube.posZ1), 0)); - newRenderers[i].cubeList = newCubes; - newRenderers[i].setRotationPoint(oldRenderers[i].rotationPointX, oldRenderers[i].rotationPointY, oldRenderers[i].rotationPointZ); - newRenderers[i].rotateAngleX = oldRenderers[i].rotateAngleX; - newRenderers[i].rotateAngleY = oldRenderers[i].rotateAngleY; - newRenderers[i].rotateAngleZ = oldRenderers[i].rotateAngleZ; - newRenderers[i].offsetX = oldRenderers[i].offsetX; - newRenderers[i].offsetY = oldRenderers[i].offsetY; - newRenderers[i].offsetZ = oldRenderers[i].offsetZ; - } - return newRenderers; - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/CommonProxy.java b/src/main/java/jackcartersmith/orbsat/common/CommonProxy.java deleted file mode 100644 index 48ba437..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/CommonProxy.java +++ /dev/null @@ -1,237 +0,0 @@ -package jackcartersmith.orbsat.common; - -import java.util.UUID; - -import com.mojang.authlib.GameProfile; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.network.IGuiHandler; - -public class CommonProxy implements IGuiHandler { - public void preInit() - { - } - - public void preInitEnd() - { - } - - public void init() - { - } - - public void initEnd() - { - } - - public void postInit() - { - } - - public void postInitEnd() - { - } - - public void serverStarting() - { - } - - public void onWorldLoad() - { - } - - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - // TODO Auto-generated method stub - return null; - } - - /* - public static void openGuiForTile(@Nonnull EntityPlayer player, @Nonnull T tile) - { - player.openGui(OrbitalSatellite.instance, tile.getGuiID(), tile.getWorld(), tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ()); - } - - public static void openGuiForItem(@Nonnull EntityPlayer player, @Nonnull EntityEquipmentSlot slot) - { - ItemStack stack = player.getItemStackFromSlot(slot); - if(stack.isEmpty()||!(stack.getItem() instanceof IGuiItem)) - return; - IGuiItem gui = (IGuiItem)stack.getItem(); - player.openGui(ImmersiveEngineering.instance, 100*slot.ordinal()+gui.getGuiID(stack), player.world, (int)player.posX, (int)player.posY, (int)player.posZ); - } - - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - if(ID >= Lib.GUIID_Base_Item) - { - EntityEquipmentSlot slot = EntityEquipmentSlot.values()[ID/100]; - ID %= 100;//Slot determined, get actual ID - ItemStack item = player.getItemStackFromSlot(slot); - if(!item.isEmpty()&&item.getItem() instanceof IGuiItem&&((IGuiItem)item.getItem()).getGuiID(item)==ID) - { - if(ID==Lib.GUIID_Revolver&&item.getItem() instanceof IEItemInterfaces.IBulletContainer) - return new ContainerRevolver(player.inventory, world, slot, item); - if(ID==Lib.GUIID_Toolbox&&item.getItem() instanceof ItemToolbox) - return new ContainerToolbox(player.inventory, world, slot, item); - } - } - else - { - TileEntity te = world.getTileEntity(new BlockPos(x, y, z)); - if(te instanceof IGuiTile) - { - Object gui = null; - if(ID==Lib.GUIID_CokeOven&&te instanceof TileEntityCokeOven) - gui = new ContainerCokeOven(player.inventory, (TileEntityCokeOven)te); - if(ID==Lib.GUIID_AlloySmelter&&te instanceof TileEntityAlloySmelter) - gui = new ContainerAlloySmelter(player.inventory, (TileEntityAlloySmelter)te); - if(ID==Lib.GUIID_BlastFurnace&&te instanceof TileEntityBlastFurnace) - gui = new ContainerBlastFurnace(player.inventory, (TileEntityBlastFurnace)te); - if(ID==Lib.GUIID_WoodenCrate&&te instanceof TileEntityWoodenCrate) - gui = new ContainerCrate(player.inventory, (TileEntityWoodenCrate)te); - if(ID==Lib.GUIID_Workbench&&te instanceof TileEntityModWorkbench) - gui = new ContainerModWorkbench(player.inventory, (TileEntityModWorkbench)te); - if(ID==Lib.GUIID_Sorter&&te instanceof TileEntitySorter) - gui = new ContainerSorter(player.inventory, (TileEntitySorter)te); - if(ID==Lib.GUIID_Squeezer&&te instanceof TileEntitySqueezer) - gui = new ContainerSqueezer(player.inventory, (TileEntitySqueezer)te); - if(ID==Lib.GUIID_Fermenter&&te instanceof TileEntityFermenter) - gui = new ContainerFermenter(player.inventory, (TileEntityFermenter)te); - if(ID==Lib.GUIID_Refinery&&te instanceof TileEntityRefinery) - gui = new ContainerRefinery(player.inventory, (TileEntityRefinery)te); - if(ID==Lib.GUIID_ArcFurnace&&te instanceof TileEntityArcFurnace) - gui = new ContainerArcFurnace(player.inventory, (TileEntityArcFurnace)te); - if(ID==Lib.GUIID_Assembler&&te instanceof TileEntityAssembler) - gui = new ContainerAssembler(player.inventory, (TileEntityAssembler)te); - if(ID==Lib.GUIID_AutoWorkbench&&te instanceof TileEntityAutoWorkbench) - gui = new ContainerAutoWorkbench(player.inventory, (TileEntityAutoWorkbench)te); - if(ID==Lib.GUIID_Mixer&&te instanceof TileEntityMixer) - gui = new ContainerMixer(player.inventory, (TileEntityMixer)te); - if(ID==Lib.GUIID_Turret&&te instanceof TileEntityTurret) - gui = new ContainerTurret(player.inventory, (TileEntityTurret)te); - if(ID==Lib.GUIID_FluidSorter&&te instanceof TileEntityFluidSorter) - gui = new ContainerFluidSorter(player.inventory, (TileEntityFluidSorter)te); - if(ID==Lib.GUIID_Belljar&&te instanceof TileEntityBelljar) - gui = new ContainerBelljar(player.inventory, (TileEntityBelljar)te); - if(ID==Lib.GUIID_ToolboxBlock&&te instanceof TileEntityToolbox) - gui = new ContainerToolboxBlock(player.inventory, (TileEntityToolbox)te); - if(gui!=null) - ((IGuiTile)te).onGuiOpened(player, false); - return gui; - } - } - return null; - } - - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - return null; - } - - public void handleTileSound(SoundEvent soundEvent, TileEntity tile, boolean tileActive, float volume, float pitch) - { - } - - public void stopTileSound(String soundName, TileEntity tile) - { - } - - public void spawnBucketWheelFX(TileEntityBucketWheel tile, ItemStack stack) - { - } - - public void spawnSparkFX(World world, double x, double y, double z, double mx, double my, double mz) - { - } - - public void spawnRedstoneFX(World world, double x, double y, double z, double mx, double my, double mz, float size, float r, float g, float b) - { - } - - public void spawnFluidSplashFX(World world, FluidStack fs, double x, double y, double z, double mx, double my, double mz) - { - } - - public void spawnBubbleFX(World world, FluidStack fs, double x, double y, double z, double mx, double my, double mz) - { - } - - public void spawnFractalFX(World world, double x, double y, double z, Vec3d direction, double scale, int prefixColour, float[][] colour) - { - } - - public void draw3DBlockCauldron() - { - } - - public void drawSpecificFluidPipe(String configuration) - { - } - - public boolean armorHasCustomModel(ItemStack stack) - { - return false; - } - - public boolean drawConveyorInGui(String conveyor, EnumFacing facing) - { - return false; - } - - public void drawFluidPumpTop() - { - } - */ - - public String[] splitStringOnWidth(String s, int w) - { - return new String[]{s}; - } - - public World getClientWorld() - { - return null; - } - - public EntityPlayer getClientPlayer() - { - return null; - } - - public String getNameFromUUID(String uuid) - { - return FMLCommonHandler.instance().getMinecraftServerInstance().getMinecraftSessionService().fillProfileProperties(new GameProfile(UUID.fromString(uuid.replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")), null), false).getName(); - } - - public void reInitGui() - { - } - - public void removeStateFromSmartModelCache(IExtendedBlockState state) - { - } - - public void removeStateFromConnectionModelCache(IExtendedBlockState state) - { - } - - public void clearConnectionModelCache() - { - } - - public void clearRenderCaches() - { - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/EventHandler.java b/src/main/java/jackcartersmith/orbsat/common/EventHandler.java deleted file mode 100644 index e8c9820..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/EventHandler.java +++ /dev/null @@ -1,61 +0,0 @@ -package jackcartersmith.orbsat.common; - -import java.util.HashSet; -import java.util.LinkedList; -import java.util.Queue; -import java.util.Set; - -import org.apache.commons.lang3.tuple.Pair; - -import jackcartersmith.orbsat.OrbitalSatellite; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; - -public class EventHandler { - //public static final ArrayList interdictionTiles = new ArrayList(); - //public static HashSet currentExplosions = new HashSet(); - public static final Queue> requestedBlockUpdates = new LinkedList<>(); - public static final Set REMOVE_FROM_TICKING = new HashSet<>(); - - @SubscribeEvent - public void onLoad(WorldEvent.Load event) - { - OrbitalSatellite.proxy.onWorldLoad(); - } - - @SubscribeEvent - public void onSave(WorldEvent.Save event) - { - OrbsatSaveData.setDirty(0); - } - - @SubscribeEvent - public void onUnload(WorldEvent.Unload event) - { - OrbsatSaveData.setDirty(0); - } - - @SubscribeEvent - public void onWorldTick(WorldTickEvent event) - { - - } - - @SubscribeEvent(priority = EventPriority.HIGH) - public void onLogin(PlayerLoggedInEvent event) - { - - } - - @SubscribeEvent(priority = EventPriority.HIGH) - public void onLogout(PlayerLoggedOutEvent event) - { - - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/OrbsatContents.java b/src/main/java/jackcartersmith/orbsat/common/OrbsatContents.java deleted file mode 100644 index c1d5f00..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/OrbsatContents.java +++ /dev/null @@ -1,100 +0,0 @@ -package jackcartersmith.orbsat.common; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import com.google.common.collect.ImmutableSet; - -import jackcartersmith.orbsat.OrbitalSatellite; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.datasync.DataSerializers; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.event.RegistryEvent.MissingMappings.Mapping; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.oredict.OreDictionary; - -@Mod.EventBusSubscriber -public class OrbsatContents { - public static ArrayList registeredOrbsatBlocks = new ArrayList(); - public static ArrayList registeredOrbsatItems = new ArrayList(); - public static List> registeredOrbsatTiles = new ArrayList<>(); - - @SubscribeEvent - public static void registerBlocks(RegistryEvent.Register event) - { - for(Block block : registeredOrbsatBlocks) - event.getRegistry().register(block.setRegistryName(createRegistryName(block.getTranslationKey()))); - } - - @SubscribeEvent - public static void registerItems(RegistryEvent.Register event) - { - for(Item item : registeredOrbsatItems) - event.getRegistry().register(item.setRegistryName(createRegistryName(item.getTranslationKey()))); - - //registerOres(); - } - - @SubscribeEvent - public static void missingItems(RegistryEvent.MissingMappings event) - { - Set knownMissing = ImmutableSet.of( - "fluidethanol", - "fluidconcrete", - "fluidbiodiesel", - "fluidplantoil", - "fluidcreosote" - ); - for(Mapping missing : event.getMappings()) - if(knownMissing.contains(missing.key.getPath())) - missing.ignore(); - } - - @SubscribeEvent - public static void registerRecipes(RegistryEvent.Register event) - { - - } - - private static ResourceLocation createRegistryName(String unlocalized) - { - unlocalized = unlocalized.substring(unlocalized.indexOf("orbsat")); - unlocalized = unlocalized.replaceFirst("\\.", ":"); - return new ResourceLocation(unlocalized); - } - - public static void registerTile(Class tile) - { - String s = tile.getSimpleName(); - s = s.substring(s.indexOf("TileEntity")+"TileEntity".length()); - GameRegistry.registerTileEntity(tile, OrbitalSatellite.MODID+":"+s); - //registeredIETiles.add(tile); - } - - public static void preInit(){ - - } - - public static void init(){ - - } - - public static void postInit(){ - - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/OrbsatSaveData.java b/src/main/java/jackcartersmith/orbsat/common/OrbsatSaveData.java deleted file mode 100644 index 9d3f8e0..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/OrbsatSaveData.java +++ /dev/null @@ -1,45 +0,0 @@ -package jackcartersmith.orbsat.common; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.storage.WorldSavedData; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.relauncher.Side; - -public class OrbsatSaveData extends WorldSavedData { - private static OrbsatSaveData INSTANCE; - public static final String dataName = "OrbitalSatellite-SaveData"; - - public OrbsatSaveData(String name) { - super(name); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) { - // TODO Auto-generated method stub - - } - - @Override - public NBTTagCompound writeToNBT(NBTTagCompound compound) { - // TODO Auto-generated method stub - return null; - } - - public static void setDirty(int dimension) - { - // if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER && INSTANCE.get(dimension)!=null) - // { - // INSTANCE.get(dimension).markDirty(); - // } - if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER&&INSTANCE!=null) - INSTANCE.markDirty(); - } - - public static void setInstance(int dimension, OrbsatSaveData in) - { - // if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER) - // INSTANCE.put(dimension, in); - if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER) - INSTANCE = in; - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/blocks/BlockOrbsatBase.java b/src/main/java/jackcartersmith/orbsat/common/blocks/BlockOrbsatBase.java deleted file mode 100644 index 6f1d3a8..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/blocks/BlockOrbsatBase.java +++ /dev/null @@ -1,236 +0,0 @@ -package jackcartersmith.orbsat.common.blocks; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import com.google.common.collect.Sets; - -import jackcartersmith.orbsat.OrbitalSatellite; -import jackcartersmith.orbsat.common.OrbsatContents; -import jackcartersmith.orbsat.common.blocks.OrbsatBlockInterface.IOrbsatMetaBlock; -import net.minecraft.block.Block; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.EnumPushReaction; -import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.statemap.StateMapperBase; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IStringSerializable; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.common.property.IUnlistedProperty; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class BlockOrbsatBase & BlockOrbsatBase.IBlockEnum> extends Block implements IOrbsatMetaBlock{ - public final String name; - public final PropertyEnum property; - - protected static IProperty[] tempProperties; - protected static IUnlistedProperty[] tempUnlistedProperties; - - public final IProperty[] additionalProperties; - public final IUnlistedProperty[] additionalUnlistedProperties; - public final E[] enumValues; - boolean[] isMetaHidden; - boolean[] hasFlavour; - protected Set renderLayers = Sets.newHashSet(BlockRenderLayer.SOLID); - protected Set[] metaRenderLayers; - protected Map metaLightOpacities = new HashMap<>(); - protected Map metaHardness = new HashMap<>(); - protected Map metaResistances = new HashMap<>(); - //protected EnumPushReaction[] metaMobilityFlags; - //protected boolean[] canHammerHarvest; - protected boolean[] metaNotNormalBlock; - private boolean opaqueCube = false; - - public BlockOrbsatBase(String name, Material material, PropertyEnum mainProperty, Class itemBlock, Object... additionalProperties) - { - super(setTempProperties(material, mainProperty, additionalProperties)); - this.name = name; - this.property = mainProperty; - this.enumValues = mainProperty.getValueClass().getEnumConstants(); - this.isMetaHidden = new boolean[this.enumValues.length]; - this.hasFlavour = new boolean[this.enumValues.length]; - this.metaRenderLayers = new Set[this.enumValues.length]; - //this.canHammerHarvest = new boolean[this.enumValues.length]; - //this.metaMobilityFlags = new EnumPushReaction[this.enumValues.length]; - - ArrayList propList = new ArrayList(); - ArrayList unlistedPropList = new ArrayList(); - for(Object o : additionalProperties) - { - if(o instanceof IProperty) - propList.add((IProperty)o); - if(o instanceof IProperty[]) - for(IProperty p : ((IProperty[])o)) - propList.add(p); - if(o instanceof IUnlistedProperty) - unlistedPropList.add((IUnlistedProperty)o); - if(o instanceof IUnlistedProperty[]) - for(IUnlistedProperty p : ((IUnlistedProperty[])o)) - unlistedPropList.add(p); - } - this.additionalProperties = propList.toArray(new IProperty[propList.size()]); - this.additionalUnlistedProperties = unlistedPropList.toArray(new IUnlistedProperty[unlistedPropList.size()]); - this.setDefaultState(getInitDefaultState()); - String registryName = createRegistryName(); - this.setTranslationKey(registryName.replace(':', '.')); - this.setCreativeTab(OrbitalSatellite.creativeTab); - this.adjustSound(); - -// ImmersiveEngineering.registerBlockByFullName(this, itemBlock, registryName); - OrbsatContents.registeredOrbsatBlocks.add(this); - try - { - OrbsatContents.registeredOrbsatItems.add(itemBlock.getConstructor(Block.class).newInstance(this)); - } catch(Exception e) - { - e.printStackTrace(); - } - lightOpacity = 255; - } - - public interface IBlockEnum extends IStringSerializable - { - int getMeta(); - - boolean listForCreative(); - } - - @Override - public String getOrbsatBlockName() { - return this.name; - } - - @Override - public Enum[] getMetaEnums() { - return enumValues; - } - - @Override - public IBlockState getInventoryState(int meta) { - return getStateFromMeta(meta); - } - - @Override - public PropertyEnum getMetaProperty() - { - return this.property; - } - - @Override - public boolean useCustomStateMapper() - { - return false; - } - - @Override - public String getCustomStateMapping(int meta, boolean itemBlock) - { - return null; - } - - @Override - @SideOnly(Side.CLIENT) - public StateMapperBase getCustomMapper() - { - return null; - } - - @Override - public boolean appendPropertiesToState() - { - return true; - } - - public String getTranslationKey(ItemStack stack) - { - String subName = getStateFromMeta(stack.getItemDamage()).getValue(property).toString().toLowerCase(Locale.US); - return super.getTranslationKey()+"."+subName; - } - - void adjustSound() - { - if(this.material==Material.ANVIL) - this.blockSoundType = SoundType.ANVIL; - else if(this.material==Material.CARPET||this.material==Material.CLOTH) - this.blockSoundType = SoundType.CLOTH; - else if(this.material==Material.GLASS||this.material==Material.ICE) - this.blockSoundType = SoundType.GLASS; - else if(this.material==Material.GRASS||this.material==Material.TNT||this.material==Material.PLANTS||this.material==Material.VINE) - this.blockSoundType = SoundType.PLANT; - else if(this.material==Material.GROUND) - this.blockSoundType = SoundType.GROUND; - else if(this.material==Material.IRON) - this.blockSoundType = SoundType.METAL; - else if(this.material==Material.SAND) - this.blockSoundType = SoundType.SAND; - else if(this.material==Material.SNOW) - this.blockSoundType = SoundType.SNOW; - else if(this.material==Material.ROCK) - this.blockSoundType = SoundType.STONE; - else if(this.material==Material.WOOD||this.material==Material.CACTUS) - this.blockSoundType = SoundType.WOOD; - } - - protected static Material setTempProperties(Material material, PropertyEnum property, Object... additionalProperties) - { - ArrayList propList = new ArrayList(); - ArrayList unlistedPropList = new ArrayList(); - propList.add(property); - for(Object o : additionalProperties) - { - if(o instanceof IProperty) - propList.add((IProperty)o); - if(o instanceof IProperty[]) - for(IProperty p : ((IProperty[])o)) - propList.add(p); - if(o instanceof IUnlistedProperty) - unlistedPropList.add((IUnlistedProperty)o); - if(o instanceof IUnlistedProperty[]) - for(IUnlistedProperty p : ((IUnlistedProperty[])o)) - unlistedPropList.add(p); - } - tempProperties = propList.toArray(new IProperty[propList.size()]); - tempUnlistedProperties = unlistedPropList.toArray(new IUnlistedProperty[unlistedPropList.size()]); - return material; - } - - protected IBlockState getInitDefaultState() - { - IBlockState state = this.blockState.getBaseState().withProperty(this.property, enumValues[0]); - for(int i = 0; i < this.additionalProperties.length; i++) - if(this.additionalProperties[i]!=null&&!this.additionalProperties[i].getAllowedValues().isEmpty()) - state = applyProperty(state, additionalProperties[i], additionalProperties[i].getAllowedValues().iterator().next()); - return state; - } - - protected > IBlockState applyProperty(IBlockState in, IProperty prop, Object val) - { - return in.withProperty(prop, (V)val); - } - - public void onOrbsatBlockPlacedBy(World world, BlockPos pos, IBlockState state, EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase placer, ItemStack stack) - { - } - - public boolean canOrbsatBlockBePlaced(World world, BlockPos pos, IBlockState newState, EnumFacing side, float hitX, float hitY, float hitZ, EntityPlayer player, ItemStack stack) - { - return true; - } - - public String createRegistryName() - { - return OrbitalSatellite.MODID+":"+name; - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/blocks/ItemBlockOrbsatBase.java b/src/main/java/jackcartersmith/orbsat/common/blocks/ItemBlockOrbsatBase.java deleted file mode 100644 index 2283e14..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/blocks/ItemBlockOrbsatBase.java +++ /dev/null @@ -1,158 +0,0 @@ -package jackcartersmith.orbsat.common.blocks; - -import javax.annotation.Nullable; - -import jackcartersmith.orbsat.client.ClientProxy; -import net.minecraft.block.Block; -import net.minecraft.block.SoundType; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.NonNullList; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class ItemBlockOrbsatBase extends ItemBlock { - private int[] burnTime; - - public ItemBlockOrbsatBase(Block block) { - super(block); - if(((BlockOrbsatBase)block).enumValues.length > 1) - setHasSubtypes(true); - this.burnTime = new int[((BlockOrbsatBase)block).enumValues!=null?((BlockOrbsatBase)block).enumValues.length: 1]; - } - - @Override - public int getMetadata(int damageValue) - { - return damageValue; - } - - @Override - public void getSubItems(CreativeTabs tab, NonNullList itemList) - { - if(this.isInCreativeTab(tab)) - this.block.getSubBlocks(tab, itemList); - } - - @Override - public String getTranslationKey(ItemStack stack) - { - return ((BlockOrbsatBase)this.block).getTranslationKey(stack); - } - - public ItemBlockOrbsatBase setBurnTime(int meta, int burnTime) - { - if(meta >= 0&&meta < this.burnTime.length) - this.burnTime[meta] = burnTime; - return this; - } - - @Override - public int getItemBurnTime(ItemStack itemStack) - { - return this.burnTime[Math.max(0, Math.min(itemStack.getMetadata(), this.burnTime.length-1))]; - } - - @Override - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) - { - if(!((BlockOrbsatBase)this.block).canOrbsatBlockBePlaced(world, pos, newState, side, hitX, hitY, hitZ, player, stack)) - return false; - boolean ret = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState); - if(ret) - { - ((BlockOrbsatBase)this.block).onOrbsatBlockPlacedBy(world, pos, newState, side, hitX, hitY, hitZ, player, stack); - } - return ret; - } - - @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) - { - ItemStack stack = player.getHeldItem(hand); - IBlockState iblockstate = world.getBlockState(pos); - Block block = iblockstate.getBlock(); - if(!block.isReplaceable(world, pos)) - pos = pos.offset(side); - if(stack.getCount() > 0&&player.canPlayerEdit(pos, side, stack)&&canBlockBePlaced(world, pos, side, stack)) - { - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = this.block.getStateForPlacement(world, pos, side, hitX, hitY, hitZ, i, player); - if(placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, iblockstate1)) - { - SoundType soundtype = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, player); - world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume()+1.0F)/2.0F, soundtype.getPitch()*0.8F); - if(!player.capabilities.isCreativeMode) - stack.shrink(1); - } - return EnumActionResult.SUCCESS; - } - return EnumActionResult.FAIL; - } - - @Override - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) - { - Block block = worldIn.getBlockState(pos).getBlock(); - - if(block==Blocks.SNOW_LAYER&&block.isReplaceable(worldIn, pos)) - { - side = EnumFacing.UP; - } - else if(!block.isReplaceable(worldIn, pos)) - { - pos = pos.offset(side); - } - - return canBlockBePlaced(worldIn, pos, side, stack); - } - - private boolean canBlockBePlaced(World w, BlockPos pos, EnumFacing side, ItemStack stack) - { - BlockOrbsatBase blockIn = (BlockOrbsatBase)this.block; - Block block = w.getBlockState(pos).getBlock(); - AxisAlignedBB axisalignedbb = blockIn.getCollisionBoundingBox(blockIn.getStateFromMeta(stack.getItemDamage()), w, pos); - if(axisalignedbb!=null&&!w.checkNoEntityCollision(axisalignedbb.offset(pos), null)) return false; - return block.isReplaceable(w, pos)&&blockIn.canPlaceBlockOnSide(w, pos, side); - } - - public static class ItemBlockIENoInventory extends ItemBlockOrbsatBase - { - public ItemBlockIENoInventory(Block b) - { - super(b); - } - - @Nullable - @Override - public NBTTagCompound getNBTShareTag(ItemStack stack) - { - NBTTagCompound ret = super.getNBTShareTag(stack); - if(ret!=null) - { - ret = ret.copy(); - ret.removeTag("inventory"); - } - return ret; - } - - @Override - public boolean getShareTag() - { - return super.getShareTag(); - } - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/blocks/OrbsatBlockInterface.java b/src/main/java/jackcartersmith/orbsat/common/blocks/OrbsatBlockInterface.java deleted file mode 100644 index f0d3e95..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/blocks/OrbsatBlockInterface.java +++ /dev/null @@ -1,363 +0,0 @@ -package jackcartersmith.orbsat.common.blocks; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; - -import javax.annotation.Nullable; - -import jackcartersmith.orbsat.common.util.OrbsatEnums; -import jackcartersmith.orbsat.common.util.OrbsatProperties.PropertyBoolInverted; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.statemap.StateMapperBase; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.NonNullList; -import net.minecraft.util.EnumFacing.Axis; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.client.model.obj.OBJModel.OBJState; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class OrbsatBlockInterface { - public interface IOrbsatMetaBlock - { - String getOrbsatBlockName(); - - IProperty getMetaProperty(); - - Enum[] getMetaEnums(); - - IBlockState getInventoryState(int meta); - - boolean useCustomStateMapper(); - - String getCustomStateMapping(int meta, boolean itemBlock); - - @SideOnly(Side.CLIENT) - StateMapperBase getCustomMapper(); - - boolean appendPropertiesToState(); - } - - public interface IAttachedIntegerProperies - { - String[] getIntPropertyNames(); - - PropertyInteger getIntProperty(String name); - - int getIntPropertyValue(String name); - - default void setValue(String name, int value) - { - } - } - - public interface IUsesBooleanProperty - { - PropertyBoolInverted getBoolProperty(Class inf); - } - - public interface IBlockOverlayText - { - String[] getOverlayText(EntityPlayer player, RayTraceResult mop, boolean hammer); - - boolean useNixieFont(EntityPlayer player, RayTraceResult mop); - } - - public interface ISoundTile - { - boolean shoudlPlaySound(String sound); - } - - public interface ISpawnInterdiction - { - double getInterdictionRangeSquared(); - } - - public interface IComparatorOverride - { - int getComparatorInputOverride(); - } - - public interface IRedstoneOutput - { - default int getWeakRSOutput(IBlockState state, EnumFacing side) - { - return getStrongRSOutput(state, side); - } - - int getStrongRSOutput(IBlockState state, EnumFacing side); - - boolean canConnectRedstone(IBlockState state, EnumFacing side); - } - - public interface ILightValue - { - int getLightValue(); - } - - public interface IColouredBlock - { - boolean hasCustomBlockColours(); - - int getRenderColour(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex); - } - - public interface IColouredTile - { - int getRenderColour(int tintIndex); - } - - public interface IDirectionalTile - { - EnumFacing getFacing(); - - void setFacing(EnumFacing facing); - - /** - * @return 0 = side clicked, 1=piston behaviour, 2 = horizontal, 3 = vertical, 4 = x/z axis, 5 = horizontal based on quadrant, 6 = horizontal preferring clicked side - */ - int getFacingLimitation(); - - default EnumFacing getFacingForPlacement(EntityLivingBase placer, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) - { - EnumFacing f = EnumFacing.DOWN; - int limit = getFacingLimitation(); - if(limit==0) - f = side; - else if(limit==1) - f = EnumFacing.getDirectionFromEntityLiving(pos, placer); - else if(limit==2) - f = EnumFacing.fromAngle(placer.rotationYaw); - else if(limit==3) - f = (side!=EnumFacing.DOWN&&(side==EnumFacing.UP||hitY <= .5))?EnumFacing.UP: EnumFacing.DOWN; - else if(limit==4) - { - f = EnumFacing.fromAngle(placer.rotationYaw); - if(f==EnumFacing.SOUTH||f==EnumFacing.WEST) - f = f.getOpposite(); - } - else if(limit==5) - { - if(side.getAxis()!=Axis.Y) - f = side.getOpposite(); - else - { - float xFromMid = hitX-.5f; - float zFromMid = hitZ-.5f; - float max = Math.max(Math.abs(xFromMid), Math.abs(zFromMid)); - if(max==Math.abs(xFromMid)) - f = xFromMid < 0?EnumFacing.WEST: EnumFacing.EAST; - else - f = zFromMid < 0?EnumFacing.NORTH: EnumFacing.SOUTH; - } - } - else if(limit==6) - f = side.getAxis()!=Axis.Y?side.getOpposite(): placer.getHorizontalFacing(); - - return mirrorFacingOnPlacement(placer)?f.getOpposite(): f; - } - - boolean mirrorFacingOnPlacement(EntityLivingBase placer); - - boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity); - - boolean canRotate(EnumFacing axis); - - default void afterRotation(EnumFacing oldDir, EnumFacing newDir) - { - } - } - - public interface IAdvancedDirectionalTile extends IDirectionalTile - { - void onDirectionalPlacement(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase placer); - } - - public interface IConfigurableSides - { - OrbsatEnums.SideConfig getSideConfig(int side); - - boolean toggleSide(int side, EntityPlayer p); - } - - public interface ITileDrop - { - /** - * Don't call this on generic TE'S, use getTileDrops or getPickBlock - */ - default ItemStack getTileDrop(@Nullable EntityPlayer player, IBlockState state) - { - NonNullList drops = getTileDrops(player, state); - return drops.size() > 0?drops.get(0): ItemStack.EMPTY; - } - - default NonNullList getTileDrops(@Nullable EntityPlayer player, IBlockState state) - { - return NonNullList.from(ItemStack.EMPTY, getTileDrop(player, state)); - } - - default ItemStack getPickBlock(@Nullable EntityPlayer player, IBlockState state, RayTraceResult rayRes) - { - return getTileDrop(player, state); - } - - void readOnPlacement(@Nullable EntityLivingBase placer, ItemStack stack); - - default boolean preventInventoryDrop() - { - return false; - } - } - - public interface IAdditionalDrops - { - Collection getExtraDrops(EntityPlayer player, IBlockState state); - } - - public interface IEntityProof - { - boolean canEntityDestroy(Entity entity); - } - - public interface IPlayerInteraction - { - boolean interact(EnumFacing side, EntityPlayer player, EnumHand hand, ItemStack heldItem, float hitX, float hitY, float hitZ); - } - - public interface IHammerInteraction - { - boolean hammerUseSide(EnumFacing side, EntityPlayer player, float hitX, float hitY, float hitZ); - } - - /* - public interface IActiveState extends IUsesBooleanProperty - { - boolean getIsActive(); - } - - public interface IDualState extends IUsesBooleanProperty - { - boolean getIsSecondState(); - } - - public interface IMirrorAble extends IUsesBooleanProperty - { - boolean getIsMirrored(); - } - */ - - public interface IBlockBounds - { - float[] getBlockBounds(); - } - - public interface IFaceShape - { - BlockFaceShape getFaceShape(EnumFacing side); - } - - public interface IAdvancedSelectionBounds extends IBlockBounds - { - List getAdvancedSelectionBounds(); - - boolean isOverrideBox(AxisAlignedBB box, EntityPlayer player, RayTraceResult mop, ArrayList list); - } - - public interface IAdvancedCollisionBounds extends IBlockBounds - { - List getAdvancedColisionBounds(); - } - - public interface IHasDummyBlocks extends IGeneralMultiblock - { - void placeDummies(BlockPos pos, IBlockState state, EnumFacing side, float hitX, float hitY, float hitZ); - - void breakDummies(BlockPos pos, IBlockState state); - - boolean isDummy(); - - @Override - default boolean isLogicDummy() - { - return isDummy(); - } - } - - /** - * super-interface for {@link TileEntityMultiblockPart} and {@link IHasDummyBlocks} - */ - public interface IGeneralMultiblock - { - boolean isLogicDummy(); - } - - public interface IHasObjProperty - { - ArrayList compileDisplayList(); - } - - public interface IAdvancedHasObjProperty - { - OBJState getOBJState(); - } - - public interface IDynamicTexture - { - @SideOnly(Side.CLIENT) - HashMap getTextureReplacements(); - } - - public interface IGuiTile - { - default boolean canOpenGui(EntityPlayer player) - { - return canOpenGui(); - } - - boolean canOpenGui(); - - int getGuiID(); - - @Nullable - TileEntity getGuiMaster(); - - default void onGuiOpened(EntityPlayer player, boolean clientside) - { - } - } - - public interface IProcessTile - { - int[] getCurrentProcessesStep(); - - int[] getCurrentProcessesMax(); - } - - public interface INeighbourChangeTile - { - void onNeighborBlockChange(BlockPos otherPos); - } - - public interface IPropertyPassthrough - { - } - - public interface ICacheData - { - Object[] getCacheData(); - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/blocks/TileEntityOrbsatBase.java b/src/main/java/jackcartersmith/orbsat/common/blocks/TileEntityOrbsatBase.java deleted file mode 100644 index 021c94e..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/blocks/TileEntityOrbsatBase.java +++ /dev/null @@ -1,177 +0,0 @@ -package jackcartersmith.orbsat.common.blocks; - -import javax.annotation.Nullable; - -import jackcartersmith.orbsat.OrbitalSatellite; -import jackcartersmith.orbsat.common.blocks.OrbsatBlockInterface.IDirectionalTile; -import jackcartersmith.orbsat.common.util.ConfigManager; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.play.server.SPacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.energy.CapabilityEnergy; - -public abstract class TileEntityOrbsatBase extends TileEntity{ - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.readCustomNBT(nbt, false); - } - - public abstract void readCustomNBT(NBTTagCompound nbt, boolean descPacket); - - @Override - public NBTTagCompound writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - this.writeCustomNBT(nbt, false); - return nbt; - } - - public abstract void writeCustomNBT(NBTTagCompound nbt, boolean descPacket); - - @Override - public SPacketUpdateTileEntity getUpdatePacket() - { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - this.writeCustomNBT(nbttagcompound, true); - return new SPacketUpdateTileEntity(this.pos, 3, nbttagcompound); - } - - @Override - public NBTTagCompound getUpdateTag() - { - NBTTagCompound nbt = super.writeToNBT(new NBTTagCompound()); - writeCustomNBT(nbt, true); - return nbt; - } - - @Override - public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) - { - this.readCustomNBT(pkt.getNbtCompound(), true); - } - - @Override - public void rotate(Rotation rot) - { - if(rot!=Rotation.NONE&&this instanceof IDirectionalTile&&((IDirectionalTile)this).canRotate(EnumFacing.UP)) - { - EnumFacing f = ((IDirectionalTile)this).getFacing(); - switch(rot) - { - case CLOCKWISE_90: - f = f.rotateY(); - break; - case CLOCKWISE_180: - f = f.getOpposite(); - break; - case COUNTERCLOCKWISE_90: - f = f.rotateYCCW(); - break; - } - ((IDirectionalTile)this).setFacing(f); - this.markDirty(); - if(this.pos!=null) - this.markBlockForUpdate(this.pos, null); - } - } - - @Override - public void mirror(Mirror mirrorIn) - { - if(mirrorIn==Mirror.FRONT_BACK&&this instanceof IDirectionalTile) - { - ((IDirectionalTile)this).setFacing(((IDirectionalTile)this).getFacing()); - this.markDirty(); - if(this.pos!=null) - this.markBlockForUpdate(this.pos, null); - } - } - - public void receiveMessageFromClient(NBTTagCompound message) {} - - public void receiveMessageFromServer(NBTTagCompound message) {} - - public void onEntityCollision(World world, Entity entity) {} - - @Override - public boolean receiveClientEvent(int id, int type) - { - if(id==0||id==255) - { - markContainingBlockForUpdate(null); - return true; - } - else if(id==254) - { - IBlockState state = world.getBlockState(pos); - if(state instanceof IExtendedBlockState) - OrbitalSatellite.proxy.removeStateFromSmartModelCache((IExtendedBlockState)state); - world.notifyBlockUpdate(pos, state, state, 3); - return true; - } - return super.receiveClientEvent(id, type); - } - - @Override - public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) - { - if(world.isBlockLoaded(pos)) - newState = world.getBlockState(pos); - if(oldState.getBlock()!=newState.getBlock()||!(oldState.getBlock() instanceof BlockOrbsatBase)||!(newState.getBlock() instanceof BlockOrbsatBase)) - return true; - IProperty type = ((BlockOrbsatBase)oldState.getBlock()).getMetaProperty(); - return oldState.getValue(type)!=newState.getValue(type); - } - - public void markContainingBlockForUpdate(@Nullable IBlockState newState) - { - markBlockForUpdate(getPos(), newState); - } - - public void markBlockForUpdate(BlockPos pos, @Nullable IBlockState newState) - { - IBlockState state = world.getBlockState(pos); - if(newState==null) - newState = state; - world.notifyBlockUpdate(pos, state, newState, 3); - world.notifyNeighborsOfStateChange(pos, newState.getBlock(), true); - } - - /* - @Override - public boolean hasCapability(Capability capability, @Nullable EnumFacing facing) - { - if(capability==CapabilityEnergy.ENERGY&&this instanceof EnergyHelper.IIEInternalFluxConnector) - return ((EnergyHelper.IIEInternalFluxConnector)this).getCapabilityWrapper(facing)!=null; - return super.hasCapability(capability, facing); - } - - @Override - public T getCapability(Capability capability, @Nullable EnumFacing facing) - { - if(capability==CapabilityEnergy.ENERGY&&this instanceof EnergyHelper.IIEInternalFluxConnector) - return (T)((EnergyHelper.IIEInternalFluxConnector)this).getCapabilityWrapper(facing); - return super.getCapability(capability, facing); - } - */ - - @Override - public double getMaxRenderDistanceSquared() - { - return super.getMaxRenderDistanceSquared()* - ConfigManager.OrbsatConfig.increasedTileRenderdistance*ConfigManager.OrbsatConfig.increasedTileRenderdistance; - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/commands/CommandHandler.java b/src/main/java/jackcartersmith/orbsat/common/commands/CommandHandler.java deleted file mode 100644 index cc5daec..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/commands/CommandHandler.java +++ /dev/null @@ -1,103 +0,0 @@ -package jackcartersmith.orbsat.common.commands; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.server.command.CommandTreeBase; -import net.minecraftforge.server.command.CommandTreeHelp; - -public class CommandHandler extends CommandTreeBase{ - private final String name; - private static final String start = "<"; - private static final String end = ">"; - - public CommandHandler(boolean client) - { - if(client) - { - addSubcommand(new CommandResetRenders()); - name = "cie"; - } - else - { - //addSubcommand(new CommandMineral()); - //addSubcommand(new CommandShaders()); - name = "ie"; - } - addSubcommand(new CommandTreeHelp(this)); - } - - @Nonnull - @Override - public String getName() - { - return name; - } - - @Nonnull - @Override - public String getUsage(@Nonnull ICommandSender sender) - { - return "Use \"/"+name+" help\" for more information"; - } - - @Override - public int getRequiredPermissionLevel() - { - return name.equals("cie")?0: 4; - } - - @Nonnull - @Override - public List getTabCompletions(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, String[] args, @Nullable BlockPos pos) - { - List ret = super.getTabCompletions(server, sender, args, pos); - for(int i = 0; i < ret.size(); i++) - { - String curr = ret.get(i); - if(curr.indexOf(' ') >= 0) - { - ret.set(i, start+curr+end); - } - } - return ret; - } - - @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, String[] args) throws CommandException - { - List argsCleaned = new ArrayList<>(args.length); - String currentPart = null; - for(String s : args) - { - if(s.startsWith(start)) - { - if(currentPart!=null) - throw new CommandException("String opens twice (once \""+currentPart+"\", once \""+s+"\")"); - currentPart = s; - } - else if(currentPart!=null) - currentPart += " "+s; - else - argsCleaned.add(s); - if(s.endsWith(end)) - { - if(currentPart==null) - throw new CommandException("String closed without being openeed first! (\""+s+"\")"); - if(currentPart.length() >= 2) - argsCleaned.add(currentPart.substring(1, currentPart.length()-1)); - currentPart = null; - } - } - if(currentPart!=null) - throw new CommandException("Unclosed string ("+currentPart+")"); - super.execute(server, sender, argsCleaned.toArray(new String[0])); - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/commands/CommandResetRenders.java b/src/main/java/jackcartersmith/orbsat/common/commands/CommandResetRenders.java deleted file mode 100644 index a7028f6..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/commands/CommandResetRenders.java +++ /dev/null @@ -1,36 +0,0 @@ -package jackcartersmith.orbsat.common.commands; - -import javax.annotation.Nonnull; - -import jackcartersmith.orbsat.OrbitalSatellite; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; -import net.minecraft.server.MinecraftServer; - -public class CommandResetRenders extends CommandBase{ - @Nonnull - @Override - public String getName() - { - return "resetrender"; - } - - @Nonnull - @Override - public String getUsage(@Nonnull ICommandSender sender) - { - return "Reset the render caches of Immersive Engineering and its addons"; - } - - @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) - { - OrbitalSatellite.proxy.clearRenderCaches(); - } - - @Override - public int getRequiredPermissionLevel() - { - return 0; - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/compat/OrbsatCompatModule.java b/src/main/java/jackcartersmith/orbsat/common/compat/OrbsatCompatModule.java deleted file mode 100644 index 22eba51..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/compat/OrbsatCompatModule.java +++ /dev/null @@ -1,106 +0,0 @@ -package jackcartersmith.orbsat.common.compat; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map.Entry; -import java.util.Set; - -import jackcartersmith.orbsat.common.util.ConfigManager; -import jackcartersmith.orbsat.common.util.LogHelper; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public abstract class OrbsatCompatModule { - public static HashMap> moduleClasses = new HashMap>(); - public static Set modules = new HashSet(); - - static - { - //moduleClasses.put("baubles", BaublesHelper.class); - //moduleClasses.put("opencomputers", OCHelper.class); - moduleClasses.put("waila", WailaHelper.class); - } - - public static void doModulesPreInit() - { - for(Entry> e : moduleClasses.entrySet()) - if(Loader.isModLoaded(e.getKey())) - try - { - //IC2 Classic is not supported. - if("ic2".equals(e.getKey())&&Loader.isModLoaded("ic2-classic-spmod")) - continue; - - Boolean enabled = ConfigManager.OrbsatConfig.compat.get(e.getKey()); - if(enabled==null||!enabled) - continue; - OrbsatCompatModule m = e.getValue().newInstance(); - modules.add(m); - m.preInit(); - } catch(Exception exception) - { - LogHelper.logger.error("Compat module for "+e.getKey()+" could not be preInitialized. Report this and include the error message below!", exception); - } - } - - public static void doModulesInit() - { - for(OrbsatCompatModule compat : OrbsatCompatModule.modules) - try - { - compat.init(); - } catch(Exception exception) - { - LogHelper.logger.error("Compat module for "+compat+" could not be initialized. Report this and include the error message below!", exception); - } - } - - public static void doModulesPostInit() - { - for(OrbsatCompatModule compat : OrbsatCompatModule.modules) - try - { - compat.postInit(); - } catch(Exception exception) - { - LogHelper.logger.error("Compat module for "+compat+" could not be postInitialized. Report this and include the error message below!", exception); - } - } - - public static boolean serverStartingDone = false; - - public static void doModulesLoadComplete() - { - if(!serverStartingDone) - { - serverStartingDone = true; - for(OrbsatCompatModule compat : OrbsatCompatModule.modules) - try - { - compat.loadComplete(); - } catch(Exception exception) - { - LogHelper.logger.error("Compat module for "+compat+" could not be initialized. Report this and include the error message below!", exception); - } - } - } - - public abstract void preInit(); - - public abstract void init(); - - public abstract void postInit(); - - public void loadComplete() {} - - @SideOnly(Side.CLIENT) - public void clientPreInit() {} - - @SideOnly(Side.CLIENT) - public void clientInit() {} - - @SideOnly(Side.CLIENT) - public void clientPostInit() {} -} diff --git a/src/main/java/jackcartersmith/orbsat/common/compat/OrbsatWailaDataProvider.java b/src/main/java/jackcartersmith/orbsat/common/compat/OrbsatWailaDataProvider.java deleted file mode 100644 index 454df88..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/compat/OrbsatWailaDataProvider.java +++ /dev/null @@ -1,7 +0,0 @@ -package jackcartersmith.orbsat.common.compat; - -import mcp.mobius.waila.api.IWailaDataProvider; - -public class OrbsatWailaDataProvider implements IWailaDataProvider { - //TODO -} diff --git a/src/main/java/jackcartersmith/orbsat/common/compat/WailaHelper.java b/src/main/java/jackcartersmith/orbsat/common/compat/WailaHelper.java deleted file mode 100644 index a3457ae..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/compat/WailaHelper.java +++ /dev/null @@ -1,22 +0,0 @@ -package jackcartersmith.orbsat.common.compat; - -import net.minecraftforge.fml.common.event.FMLInterModComms; - -public class WailaHelper extends OrbsatCompatModule -{ - @Override - public void preInit() - { - } - - @Override - public void init() - { - FMLInterModComms.sendMessage("waila", "register", "jackcartersmith.orbsat.common.compat.OrbsatWailaDataProvider.callbackRegister"); - } - - @Override - public void postInit() - { - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/util/ConfigManager.java b/src/main/java/jackcartersmith/orbsat/common/util/ConfigManager.java deleted file mode 100644 index da39e57..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/util/ConfigManager.java +++ /dev/null @@ -1,42 +0,0 @@ -package jackcartersmith.orbsat.common.util; - -import java.util.HashMap; -import java.util.Map; - -import com.google.common.collect.Maps; - -import jackcartersmith.orbsat.OrbitalSatellite; -import jackcartersmith.orbsat.common.compat.OrbsatCompatModule; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Config.Comment; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - -@Mod.EventBusSubscriber -public class ConfigManager { - public static HashMap manual_bool = new HashMap(); - public static HashMap manual_int = new HashMap(); - public static HashMap manual_intA = new HashMap(); - public static HashMap manual_double = new HashMap(); - public static HashMap manual_doubleA = new HashMap(); - - @net.minecraftforge.common.config.Config(modid = OrbitalSatellite.MODID) - public static class OrbsatConfig { - @Comment({"A list of all mods that OrbSat has integrated compatability for", "Setting any of these to false disables the respective compat"}) - public static Map compat = Maps.newHashMap(Maps.toMap(OrbsatCompatModule.moduleClasses.keySet(), (s) -> Boolean.TRUE)); - @Comment({"Increase the distance at which certain TileEntities (specifically windmills) are still visible. This is a modifier, so set it to 1 for default render distance, to 2 for doubled distance and so on."}) - public static double increasedTileRenderdistance = 1.5; - } - - static Configuration config; - - public static void preInit(FMLPreInitializationEvent event) - { - onConfigUpdate(); - } - - private static void onConfigUpdate() - { - - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/util/Lib.java b/src/main/java/jackcartersmith/orbsat/common/util/Lib.java deleted file mode 100644 index 8c8c2d8..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/util/Lib.java +++ /dev/null @@ -1,41 +0,0 @@ -package jackcartersmith.orbsat.common.util; - -import jackcartersmith.orbsat.OrbitalSatellite; - -public class Lib { - public static final String MODID = OrbitalSatellite.MODID; - - public static final String[] METALS_IE = {"Copper", "Aluminum", "Lead", "Silver", "Nickel", "Uranium", "Constantan", "Electrum", "Steel"}; - public static final String[] METALS_ALL = {"Copper", "Aluminum", "Lead", "Silver", "Nickel", "Uranium", "Constantan", "Electrum", "Steel", "Iron", "Gold"}; - - public static final String TOOL_HAMMER = "IE_HAMMER"; - public static final String TOOL_WIRECUTTER = "IE_WIRECUTTER"; - - public static final String CHAT = "chat."+MODID+"."; - public static final String CHAT_WARN = CHAT+"warning."; - public static final String CHAT_INFO = CHAT+"info."; - public static final String CHAT_COMMAND = CHAT+"command."; - - public static final String DESC = "desc."+MODID+"."; - public static final String DESC_INFO = DESC+"info."; - public static final String DESC_FLAVOUR = DESC+"flavour."; - - public static final String GUI = "gui."+MODID+"."; - public static final String GUI_CONFIG = "gui."+MODID+".config."; - - public static final int COLOUR_I_ImmersiveOrange = 0xfff78034; - public static final float[] COLOUR_F_ImmersiveOrange = {247/255f, 128/255f, 52/255f}; - public static final int COLOUR_I_ImmersiveOrangeShadow = 0xff3e200d; - - /** - * Gui IDs - */ - //Tiles - public static final int GUIID_Base_Tile = 0; - - //Items - public static final int GUIID_Base_Item = 64; - - - public static final int colour_nixieTubeText = 0xff9900; -} diff --git a/src/main/java/jackcartersmith/orbsat/common/util/LogHelper.java b/src/main/java/jackcartersmith/orbsat/common/util/LogHelper.java deleted file mode 100644 index 43eeca5..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/util/LogHelper.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Based on the work of BluSunrize - */ - -package jackcartersmith.orbsat.common.util; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.Logger; - -public class LogHelper { - public static Logger logger; - - public static void log(Level logLevel, Object object) - { - logger.log(logLevel, String.valueOf(object)); - } - - public static void error(Object object) - { - log(Level.ERROR, object); - } - - public static void info(Object object) - { - log(Level.INFO, object); - } - - public static void warn(Object object) - { - log(Level.WARN, object); - } - - public static void error(String message, Object... params) - { - logger.log(Level.ERROR, message, params); - } - - public static void info(String message, Object... params) - { - logger.log(Level.INFO, message, params); - } - - public static void warn(String message, Object... params) - { - logger.log(Level.WARN, message, params); - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/util/OrbsatEnums.java b/src/main/java/jackcartersmith/orbsat/common/util/OrbsatEnums.java deleted file mode 100644 index 2cea559..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/util/OrbsatEnums.java +++ /dev/null @@ -1,37 +0,0 @@ -package jackcartersmith.orbsat.common.util; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public class OrbsatEnums { - public enum SideConfig implements IStringSerializable - { - NONE("none"), - INPUT("in"), - OUTPUT("out"); - - final String texture; - - SideConfig(String texture) - { - this.texture = texture; - } - - @Override - public String getName() - { - return this.toString().toLowerCase(Locale.ENGLISH); - } - - public String getTextureName() - { - return texture; - } - - public static SideConfig next(SideConfig current) - { - return current==INPUT?OUTPUT: current==OUTPUT?NONE: INPUT; - } - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/util/OrbsatProperties.java b/src/main/java/jackcartersmith/orbsat/common/util/OrbsatProperties.java deleted file mode 100644 index dbf99f0..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/util/OrbsatProperties.java +++ /dev/null @@ -1,215 +0,0 @@ -package jackcartersmith.orbsat.common.util; - -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableList; - -import jackcartersmith.orbsat.common.util.OrbsatEnums.SideConfig; -import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.properties.PropertyHelper; -import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.property.IUnlistedProperty; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Set; - -public class OrbsatProperties { - public static final PropertyDirection FACING_ALL = PropertyDirection.create("facing"); - public static final PropertyDirection FACING_HORIZONTAL = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); - - public static final PropertyBoolInverted MULTIBLOCKSLAVE = PropertyBoolInverted.create("_0multiblockslave");//Name starts with '_0' to ensure priority when overriding models - public static final PropertyBoolInverted DYNAMICRENDER = PropertyBoolInverted.create("_1dynamicrender");//Name starts with '_1' to ensure priority over anything but the multiblockslave property - public static final PropertySet CONNECTIONS = new PropertySet("conns"); - - // public static final PropertyEnum[] SIDECONFIG = { -// PropertyEnum.create("sideconfig_down", IEEnums.SideConfig.class), -// PropertyEnum.create("sideconfig_up", IEEnums.SideConfig.class), -// PropertyEnum.create("sideconfig_north", IEEnums.SideConfig.class), -// PropertyEnum.create("sideconfig_south", IEEnums.SideConfig.class), -// PropertyEnum.create("sideconfig_west", IEEnums.SideConfig.class), -// PropertyEnum.create("sideconfig_east", IEEnums.SideConfig.class) -// }; - public static final ProperySideConfig[] SIDECONFIG = { - new ProperySideConfig("sideconfig_down"), - new ProperySideConfig("sideconfig_up"), - new ProperySideConfig("sideconfig_north"), - new ProperySideConfig("sideconfig_south"), - new ProperySideConfig("sideconfig_west"), - new ProperySideConfig("sideconfig_east") - }; - public static final PropertyBoolInverted[] SIDECONNECTION = { - PropertyBoolInverted.create("sideconnection_down"), - PropertyBoolInverted.create("sideconnection_up"), - PropertyBoolInverted.create("sideconnection_north"), - PropertyBoolInverted.create("sideconnection_south"), - PropertyBoolInverted.create("sideconnection_west"), - PropertyBoolInverted.create("sideconnection_east") - }; - - //An array of non-descript booleans for mirroring, active textures, etc. - public static final PropertyBoolInverted[] BOOLEANS = { - PropertyBoolInverted.create("boolean0"), - PropertyBoolInverted.create("boolean1"), - PropertyBoolInverted.create("boolean2") - }; - public static final PropertyInteger INT_4 = PropertyInteger.create("int_4", 0, 3); - public static final PropertyInteger INT_16 = PropertyInteger.create("int_16", 0, 15); - - public static class ProperySideConfig implements IUnlistedProperty - { - final String name; - - public ProperySideConfig(String name) - { - this.name = name; - } - - @Override - public String getName() - { - return name; - } - - @Override - public boolean isValid(SideConfig value) - { - return true; - } - - @Override - public Class getType() - { - return OrbsatEnums.SideConfig.class; - } - - @Override - public String valueToString(SideConfig value) - { - return value.toString(); - } - } - - public static final IUnlistedProperty OBJ_TEXTURE_REMAP = new IUnlistedProperty() - { - @Override - public String getName() - { - return "obj_texture_remap"; - } - - @Override - public boolean isValid(HashMap value) - { - return true; - } - - @Override - public Class getType() - { - return HashMap.class; - } - - @Override - public String valueToString(HashMap value) - { - return value.toString(); - } - }; - - public static class PropertyBoolInverted extends PropertyHelper - { - private static final ImmutableList ALLOWED_VALUES = ImmutableList.of(false, true); - - protected PropertyBoolInverted(String name) - { - super(name, Boolean.class); - } - - @Override - public Collection getAllowedValues() - { - return ALLOWED_VALUES; - } - - @Override - public Optional parseValue(String value) - { - return Optional.of(Boolean.parseBoolean(value)); - } - - public static PropertyBoolInverted create(String name) - { - return new PropertyBoolInverted(name); - } - - @Override - public String getName(Boolean value) - { - return value.toString(); - } - } - - @SuppressWarnings("rawtypes") - public static class PropertySet implements IUnlistedProperty - { - String name; - - public PropertySet(String n) - { - name = n; - } - - @Override - public String getName() - { - return name; - } - - @Override - public boolean isValid(Set value) - { - return value!=null; - } - - @Override - public Class getType() - { - return Set.class; - } - - @Override - public String valueToString(Set value) - { - return value.toString(); - } - } - - public static final IUnlistedProperty TILEENTITY_PASSTHROUGH = new IUnlistedProperty() - { - @Override - public String getName() - { - return "tileentity_passthrough"; - } - - @Override - public boolean isValid(TileEntity value) - { - return true; - } - - @Override - public Class getType() - { - return TileEntity.class; - } - - @Override - public String valueToString(TileEntity value) - { - return value.toString(); - } - }; -} diff --git a/src/main/java/jackcartersmith/orbsat/common/util/network/MessageRequestBlockUpdate.java b/src/main/java/jackcartersmith/orbsat/common/util/network/MessageRequestBlockUpdate.java deleted file mode 100644 index 41e36a1..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/util/network/MessageRequestBlockUpdate.java +++ /dev/null @@ -1,53 +0,0 @@ -package jackcartersmith.orbsat.common.util.network; - -import org.apache.commons.lang3.tuple.ImmutablePair; - -import io.netty.buffer.ByteBuf; -import jackcartersmith.orbsat.common.EventHandler; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldServer; -import net.minecraftforge.fml.common.network.simpleimpl.IMessage; -import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; - -public class MessageRequestBlockUpdate implements IMessage{ - BlockPos pos; - - public MessageRequestBlockUpdate(BlockPos pos) - { - this.pos = pos; - } - - public MessageRequestBlockUpdate() - { - } - - @Override - public void fromBytes(ByteBuf buf) - { - pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); - } - - @Override - public void toBytes(ByteBuf buf) - { - buf.writeInt(pos.getX()).writeInt(pos.getY()).writeInt(pos.getZ()); - } - - public static class Handler implements IMessageHandler - { - @Override - public IMessage onMessage(MessageRequestBlockUpdate message, MessageContext ctx) - { - WorldServer world = ctx.getServerHandler().player.getServerWorld(); - world.addScheduledTask(() -> { - if(world.isBlockLoaded(message.pos)) - { - int dim = world.provider.getDimension(); - EventHandler.requestedBlockUpdates.offer(new ImmutablePair<>(dim, message.pos)); - } - }); - return null; - } - } -} diff --git a/src/main/java/jackcartersmith/orbsat/common/util/network/MessageTileSync.java b/src/main/java/jackcartersmith/orbsat/common/util/network/MessageTileSync.java deleted file mode 100644 index d8dc173..0000000 --- a/src/main/java/jackcartersmith/orbsat/common/util/network/MessageTileSync.java +++ /dev/null @@ -1,78 +0,0 @@ -package jackcartersmith.orbsat.common.util.network; - -import io.netty.buffer.ByteBuf; -import jackcartersmith.orbsat.OrbitalSatellite; -import jackcartersmith.orbsat.common.blocks.TileEntityOrbsatBase; -import net.minecraft.client.Minecraft; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraftforge.fml.common.network.ByteBufUtils; -import net.minecraftforge.fml.common.network.simpleimpl.IMessage; -import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; - -public class MessageTileSync implements IMessage { - BlockPos pos; - NBTTagCompound nbt; - - public MessageTileSync(TileEntityOrbsatBase tile, NBTTagCompound nbt) - { - this.pos = tile.getPos(); - this.nbt = nbt; - } - - public MessageTileSync() - { - } - - @Override - public void fromBytes(ByteBuf buf) { - this.pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); - this.nbt = ByteBufUtils.readTag(buf); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(pos.getX()).writeInt(pos.getY()).writeInt(pos.getZ()); - ByteBufUtils.writeTag(buf, this.nbt); - } - - public static class HandlerServer implements IMessageHandler - { - @Override - public IMessage onMessage(MessageTileSync message, MessageContext ctx) - { - WorldServer world = ctx.getServerHandler().player.getServerWorld(); - world.addScheduledTask(() -> { - if(world.isBlockLoaded(message.pos)) - { - TileEntity tile = world.getTileEntity(message.pos); - if(tile instanceof TileEntityOrbsatBase) - ((TileEntityOrbsatBase)tile).receiveMessageFromClient(message.nbt); - } - }); - return null; - } - } - - public static class HandlerClient implements IMessageHandler - { - @Override - public IMessage onMessage(MessageTileSync message, MessageContext ctx) - { - Minecraft.getMinecraft().addScheduledTask(() -> { - World world = OrbitalSatellite.proxy.getClientWorld(); - if (world!=null) // This can happen if the task is scheduled right before leaving the world - { - TileEntity tile = world.getTileEntity(message.pos); - if(tile instanceof TileEntityOrbsatBase) - ((TileEntityOrbsatBase)tile).receiveMessageFromServer(message.nbt); - } - }); - return null; - } - } -} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index a022f6f..3133d05 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -2,13 +2,14 @@ { "modid": "orbsat", "name": "Orbital Satellite", - "description": "Multi-usage satellite with control center and launch bay.", - "version": "0.1.3", + "description": "Use orbital satellite to enhance your gameplay: teleport, defense, heal, scan...", + "version": "0.0.1", "mcversion": "${mcversion}", - "url": "", + "url": "mcmods.jcsmith.fr/orbsat/", + "updateJSON": "mcmods.jcsmith.fr/orbsat/versions.json" "authorList": ["JackCarterSmith"], "credits": "Thanks for Forge community, Discord and BluSunrize!", - "logoFile": "", + "logoFile": "assets/orbsat/textures/logo.png", "dependencies": [] } ] diff --git a/versions.json b/versions.json new file mode 100644 index 0000000..d868789 --- /dev/null +++ b/versions.json @@ -0,0 +1,10 @@ +{ + "homepage": "mcmods.jcsmith.fr/orbsat/", + "1.12.2": { + "0.0.1": "- First pre-release", + }, + "promos": { + "1.12.2-latest": "0.0.1", + "1.12.2-recommended": "0.0.1", + } +} \ No newline at end of file