And... again reboot all code
This commit is contained in:
parent
5ef2ec3205
commit
00bb3a82bb
@ -62,8 +62,8 @@ minecraft {
|
|||||||
runDir = "eclipse"
|
runDir = "eclipse"
|
||||||
|
|
||||||
mappings = "stable_39"
|
mappings = "stable_39"
|
||||||
//mappings = "snapshot_20171003"
|
//mappings = "snapshot_20180814"
|
||||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -129,4 +129,4 @@ processResources {
|
|||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude "mcmod.info"
|
exclude "mcmod.info"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||||
baseVersion=1.0
|
baseVersion=1.0
|
||||||
minecraftVersion=1.12.2
|
minecraftVersion=1.12.2
|
||||||
forgeVersion=14.23.5.2838
|
forgeVersion=14.23.5.2847
|
||||||
org.gradle.jvmargs=-Xmx4G
|
org.gradle.jvmargs=-Xmx4G
|
||||||
|
|
||||||
|
1
models/ModelPhotonCollector.bbmodel
Normal file
1
models/ModelPhotonCollector.bbmodel
Normal file
File diff suppressed because one or more lines are too long
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +1,14 @@
|
|||||||
package jackcartersmith.orbsat;
|
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.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.ItemStack;
|
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.Mod;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
|
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
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.FMLModIdMappingEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
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",
|
@Mod(modid = OrbitalSatellite.MODID, name = OrbitalSatellite.NAME, version = OrbitalSatellite.VERSION, modLanguage = "java",
|
||||||
certificateFingerprint = "30f9f06606e9ab799c59ec743cab264c8310531d", dependencies = "required-after:forge@[14.23.5.2838,)")
|
certificateFingerprint = "30f9f06606e9ab799c59ec743cab264c8310531d", dependencies = "required-after:forge@[14.23.5.2838,)")
|
||||||
@ -85,12 +66,15 @@ public class OrbitalSatellite {
|
|||||||
proxy.postInitEnd();
|
proxy.postInitEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void loadComplete(FMLLoadCompleteEvent event)
|
public void loadComplete(FMLLoadCompleteEvent event)
|
||||||
{
|
{
|
||||||
OrbsatCompatModule.doModulesLoadComplete();
|
OrbsatCompatModule.doModulesLoadComplete();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void serverStarting(FMLServerStartingEvent event)
|
public void serverStarting(FMLServerStartingEvent event)
|
||||||
{
|
{
|
||||||
@ -108,11 +92,10 @@ public class OrbitalSatellite {
|
|||||||
{
|
{
|
||||||
LogHelper.info("WorldData loading");
|
LogHelper.info("WorldData loading");
|
||||||
|
|
||||||
/*
|
|
||||||
//Clear out any info from previous worlds
|
//Clear out any info from previous worlds
|
||||||
for(int dim : ImmersiveNetHandler.INSTANCE.getRelevantDimensions())
|
//for(int dim : ImmersiveNetHandler.INSTANCE.getRelevantDimensions())
|
||||||
ImmersiveNetHandler.INSTANCE.clearAllConnections(dim);
|
// ImmersiveNetHandler.INSTANCE.clearAllConnections(dim);
|
||||||
*/
|
|
||||||
OrbsatSaveData worldData = (OrbsatSaveData)world.loadData(OrbsatSaveData.class, OrbsatSaveData.dataName);
|
OrbsatSaveData worldData = (OrbsatSaveData)world.loadData(OrbsatSaveData.class, OrbsatSaveData.dataName);
|
||||||
|
|
||||||
if(worldData==null)
|
if(worldData==null)
|
||||||
@ -127,6 +110,7 @@ public class OrbitalSatellite {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void modIDMapping(FMLModIdMappingEvent event) {}
|
public void modIDMapping(FMLModIdMappingEvent event) {}
|
||||||
@ -150,6 +134,7 @@ public class OrbitalSatellite {
|
|||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void wrongSignature(FMLFingerprintViolationEvent event)
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
@ -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<String, ResourceLocation> resourceMap = new HashMap<String, ResourceLocation>();
|
|
||||||
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<ModelBox> newCubes = new ArrayList<ModelBox>();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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 <T extends TileEntity & IGuiTile> 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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<ISpawnInterdiction> interdictionTiles = new ArrayList<ISpawnInterdiction>();
|
|
||||||
//public static HashSet<IEExplosion> currentExplosions = new HashSet<IEExplosion>();
|
|
||||||
public static final Queue<Pair<Integer, BlockPos>> requestedBlockUpdates = new LinkedList<>();
|
|
||||||
public static final Set<TileEntity> 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)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<Block> registeredOrbsatBlocks = new ArrayList<Block>();
|
|
||||||
public static ArrayList<Item> registeredOrbsatItems = new ArrayList<Item>();
|
|
||||||
public static List<Class<? extends TileEntity>> registeredOrbsatTiles = new ArrayList<>();
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void registerBlocks(RegistryEvent.Register<Block> event)
|
|
||||||
{
|
|
||||||
for(Block block : registeredOrbsatBlocks)
|
|
||||||
event.getRegistry().register(block.setRegistryName(createRegistryName(block.getTranslationKey())));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void registerItems(RegistryEvent.Register<Item> event)
|
|
||||||
{
|
|
||||||
for(Item item : registeredOrbsatItems)
|
|
||||||
event.getRegistry().register(item.setRegistryName(createRegistryName(item.getTranslationKey())));
|
|
||||||
|
|
||||||
//registerOres();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void missingItems(RegistryEvent.MissingMappings<Item> event)
|
|
||||||
{
|
|
||||||
Set<String> knownMissing = ImmutableSet.of(
|
|
||||||
"fluidethanol",
|
|
||||||
"fluidconcrete",
|
|
||||||
"fluidbiodiesel",
|
|
||||||
"fluidplantoil",
|
|
||||||
"fluidcreosote"
|
|
||||||
);
|
|
||||||
for(Mapping<Item> missing : event.getMappings())
|
|
||||||
if(knownMissing.contains(missing.key.getPath()))
|
|
||||||
missing.ignore();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void registerRecipes(RegistryEvent.Register<IRecipe> 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<? extends TileEntity> 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(){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<E extends Enum<E> & BlockOrbsatBase.IBlockEnum> extends Block implements IOrbsatMetaBlock{
|
|
||||||
public final String name;
|
|
||||||
public final PropertyEnum<E> 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<BlockRenderLayer> renderLayers = Sets.newHashSet(BlockRenderLayer.SOLID);
|
|
||||||
protected Set<BlockRenderLayer>[] metaRenderLayers;
|
|
||||||
protected Map<Integer, Integer> metaLightOpacities = new HashMap<>();
|
|
||||||
protected Map<Integer, Float> metaHardness = new HashMap<>();
|
|
||||||
protected Map<Integer, Integer> metaResistances = new HashMap<>();
|
|
||||||
//protected EnumPushReaction[] metaMobilityFlags;
|
|
||||||
//protected boolean[] canHammerHarvest;
|
|
||||||
protected boolean[] metaNotNormalBlock;
|
|
||||||
private boolean opaqueCube = false;
|
|
||||||
|
|
||||||
public BlockOrbsatBase(String name, Material material, PropertyEnum<E> mainProperty, Class<? extends ItemBlockOrbsatBase> 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<IProperty> propList = new ArrayList<IProperty>();
|
|
||||||
ArrayList<IUnlistedProperty> unlistedPropList = new ArrayList<IUnlistedProperty>();
|
|
||||||
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<E> 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<IProperty> propList = new ArrayList<IProperty>();
|
|
||||||
ArrayList<IUnlistedProperty> unlistedPropList = new ArrayList<IUnlistedProperty>();
|
|
||||||
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 <V extends Comparable<V>> IBlockState applyProperty(IBlockState in, IProperty<V> 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<ItemStack> 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<? extends IUsesBooleanProperty> 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<ItemStack> drops = getTileDrops(player, state);
|
|
||||||
return drops.size() > 0?drops.get(0): ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
default NonNullList<ItemStack> 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<ItemStack> 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<AxisAlignedBB> getAdvancedSelectionBounds();
|
|
||||||
|
|
||||||
boolean isOverrideBox(AxisAlignedBB box, EntityPlayer player, RayTraceResult mop, ArrayList<AxisAlignedBB> list);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IAdvancedCollisionBounds extends IBlockBounds
|
|
||||||
{
|
|
||||||
List<AxisAlignedBB> 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<String> compileDisplayList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IAdvancedHasObjProperty
|
|
||||||
{
|
|
||||||
OBJState getOBJState();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IDynamicTexture
|
|
||||||
{
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
HashMap<String, String> 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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -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> T getCapability(Capability<T> 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<String> getTabCompletions(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, String[] args, @Nullable BlockPos pos)
|
|
||||||
{
|
|
||||||
List<String> 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<String> 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]));
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<String, Class<? extends OrbsatCompatModule>> moduleClasses = new HashMap<String, Class<? extends OrbsatCompatModule>>();
|
|
||||||
public static Set<OrbsatCompatModule> modules = new HashSet<OrbsatCompatModule>();
|
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
//moduleClasses.put("baubles", BaublesHelper.class);
|
|
||||||
//moduleClasses.put("opencomputers", OCHelper.class);
|
|
||||||
moduleClasses.put("waila", WailaHelper.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void doModulesPreInit()
|
|
||||||
{
|
|
||||||
for(Entry<String, Class<? extends OrbsatCompatModule>> 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() {}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package jackcartersmith.orbsat.common.compat;
|
|
||||||
|
|
||||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
|
||||||
|
|
||||||
public class OrbsatWailaDataProvider implements IWailaDataProvider {
|
|
||||||
//TODO
|
|
||||||
}
|
|
@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<String, Boolean> manual_bool = new HashMap<String, Boolean>();
|
|
||||||
public static HashMap<String, Integer> manual_int = new HashMap<String, Integer>();
|
|
||||||
public static HashMap<String, int[]> manual_intA = new HashMap<String, int[]>();
|
|
||||||
public static HashMap<String, Double> manual_double = new HashMap<String, Double>();
|
|
||||||
public static HashMap<String, double[]> manual_doubleA = new HashMap<String, double[]>();
|
|
||||||
|
|
||||||
@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<String, Boolean> 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()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<SideConfig>
|
|
||||||
{
|
|
||||||
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<SideConfig> getType()
|
|
||||||
{
|
|
||||||
return OrbsatEnums.SideConfig.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String valueToString(SideConfig value)
|
|
||||||
{
|
|
||||||
return value.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final IUnlistedProperty<HashMap> OBJ_TEXTURE_REMAP = new IUnlistedProperty<HashMap>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return "obj_texture_remap";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid(HashMap value)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<HashMap> getType()
|
|
||||||
{
|
|
||||||
return HashMap.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String valueToString(HashMap value)
|
|
||||||
{
|
|
||||||
return value.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static class PropertyBoolInverted extends PropertyHelper<Boolean>
|
|
||||||
{
|
|
||||||
private static final ImmutableList<Boolean> ALLOWED_VALUES = ImmutableList.of(false, true);
|
|
||||||
|
|
||||||
protected PropertyBoolInverted(String name)
|
|
||||||
{
|
|
||||||
super(name, Boolean.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<Boolean> getAllowedValues()
|
|
||||||
{
|
|
||||||
return ALLOWED_VALUES;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Boolean> 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<Set>
|
|
||||||
{
|
|
||||||
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<Set> getType()
|
|
||||||
{
|
|
||||||
return Set.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String valueToString(Set value)
|
|
||||||
{
|
|
||||||
return value.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final IUnlistedProperty<TileEntity> TILEENTITY_PASSTHROUGH = new IUnlistedProperty<TileEntity>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return "tileentity_passthrough";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid(TileEntity value)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<TileEntity> getType()
|
|
||||||
{
|
|
||||||
return TileEntity.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String valueToString(TileEntity value)
|
|
||||||
{
|
|
||||||
return value.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
@ -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<MessageRequestBlockUpdate, IMessage>
|
|
||||||
{
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<MessageTileSync, IMessage>
|
|
||||||
{
|
|
||||||
@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<MessageTileSync, IMessage>
|
|
||||||
{
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,13 +2,14 @@
|
|||||||
{
|
{
|
||||||
"modid": "orbsat",
|
"modid": "orbsat",
|
||||||
"name": "Orbital Satellite",
|
"name": "Orbital Satellite",
|
||||||
"description": "Multi-usage satellite with control center and launch bay.",
|
"description": "Use orbital satellite to enhance your gameplay: teleport, defense, heal, scan...",
|
||||||
"version": "0.1.3",
|
"version": "0.0.1",
|
||||||
"mcversion": "${mcversion}",
|
"mcversion": "${mcversion}",
|
||||||
"url": "",
|
"url": "mcmods.jcsmith.fr/orbsat/",
|
||||||
|
"updateJSON": "mcmods.jcsmith.fr/orbsat/versions.json"
|
||||||
"authorList": ["JackCarterSmith"],
|
"authorList": ["JackCarterSmith"],
|
||||||
"credits": "Thanks for Forge community, Discord and BluSunrize!",
|
"credits": "Thanks for Forge community, Discord and BluSunrize!",
|
||||||
"logoFile": "",
|
"logoFile": "assets/orbsat/textures/logo.png",
|
||||||
"dependencies": []
|
"dependencies": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
10
versions.json
Normal file
10
versions.json
Normal file
@ -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",
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user