Compare commits

..

7 Commits

Author SHA1 Message Date
fbec0ad484
Unusable FG4 with old deps, revert to FG2 2024-03-10 18:46:01 +01:00
8bfe6bda7f
Update FG to v4 for compat 2024-03-09 16:32:02 +01:00
c15d2623e5
Update gradle to the lastest fix 2020-05-12 10:37:39 +02:00
5aeab91566
Revert "Updated config to the new version format"
This reverts commit 97dcabc527ec1d23c8d5d3ee8400f70f81b048d7.

First attempt to sign with automated process
2020-04-01 01:08:37 +02:00
97dcabc527 Updated config to the new version format
Cleaned up unecessary files.

Signed-off-by: JackCarterSmith <arechristopher1@gmail.com>
2020-04-01 00:30:17 +02:00
e50b6287a9 First experiment with simple blockbase
Need to investigate IBlockState system
2019-11-07 23:42:03 +01:00
00bb3a82bb And... again reboot all code 2019-11-07 20:11:19 +01:00
56 changed files with 1588 additions and 2762 deletions

7
.gitignore vendored
View File

@ -1,5 +1,6 @@
# eclipse
bin
eclipse
*.launch
.settings
.metadata
@ -8,6 +9,7 @@ bin
# idea
out
classes
*.ipr
*.iws
*.iml
@ -18,5 +20,8 @@ build
.gradle
# other
eclipse
*.DS_Store*
run
!LICENSE
!README.*
!.gitignore

View File

@ -16,4 +16,4 @@ Il permet d'ajouter Ă  vos mondes minecraft ~~de la pollution spatiale~~ des sat
## Crédits
Created by JackCarterSmith
Inspired by Thaumcraft, Draconic Evolution and Immersive Engineering
Inspired by the work of BluSunrize

71
TODO.md
View File

@ -1,71 +0,0 @@
A faire prochainement :
- [ ] Faire un item Satellite et y ajouter des 'metadata' pour différents types de Satellite
(pour commencer en faire 3 : Low, Med, High)
- [ ] Un seul ordinateur de visée permet de tirer soit en cliquant sur le bloc, soit en spécifiant
des coordonnées. Upgrades à prévoir.
- [ ] Un satellite = un ID, le satellite est lancé avec une fusée, lors du lancement le joueur
recoit une plaque avec l'ID du satellite.
- [ ] Ajout de la centrale de controle satellite, multiblock, avec parabole et clignotement (si possible)
permet Ă  partir de la plaque ID du satellite d'en prendre le contrĂ´le et demander des missions de tir Ă 
des coordonnées specs.
- [ ] On doit lier l'ordinateur de visée à la centrale pour pouvoir lier le satellite à l'ordinateur,
si la centrale n'a plus d'énergie ou si elle est détruite, l'ordinateur ne peux plus demander de frappe.
- [ ] Si l'ordinateur est équippé du module 'HyperSpace Communicator', il est indépendant de la centrale.
Cependant la frappe est imprécise à +- 10 blocs, de plus il y a 40% de chance que la demande échoue mais
consomme quand mĂŞme de la batterie Ă  l'ordinateur.
- [ ] Après chaque tir, selon le type de satellite, il y a un temps de rechargement/refroidissement entre
un autre tir.
- [ ] Update secret : Remplacer les coordonées X Y Z par les 3 parties de l'ID d'un satellite, ce dernier
est détruit si la centrale ordonne le tir et s'il n'est pas pourvu de bouclier.
- [ ] Ajout générateur de bouclier, un générateur = un satellite.
- [ ] Ajout d'un bouton d'autodestruction sur la centrale
- [ ] Tous satellites n'ayant pas reçu de connection au bout de 7j minecraftiens sera automatiquement détruis
- [ ] Ajout d'une structure auto-générer de satellite crashé d'un ancien temps, loot de pièce et d'upgrade
pour satellites dedans, rarité 1 pour un carré de 5 chucks
- [ ] Ajout d'un constructeur de satellite avec une table de craft bien spécifique pour customisé son satellite
Liste d'idées :
---------------
- [ ] Mettre à jour le gestion de la détection du tir: part du bloc le plus
haut en coordonnée Y, descends un par un et le premier bloc touché serra
celui qui subira l'explosion.
- [ ] Implémanter 3 tailles différentes de laser, 1 pour le Low, 2 pour le Med et 3 pour le High
- [ ] Rendre plus difficile d'accès le Med et le High
- [ ] Craft de plusieurs satellites plus complexe, mais à différentes durée de vie.
- [ ] Ajout du bloc brouilleur, impossible de demander un tir ou de tirer dans
ça zone d'action
- [ ] Ajout du bloc relais, permet de communiquer avec un satellite en orbite
(remplace l'overrider actuel), permet de précisé les coordonées de tir manuel,
la désactivation du satellite (pouvant être hacké, offrant alors la possibilité de changer
les sets de réglages et déraglant ainsi la visée, rendant le satellite hors d'état,
il peut être reconfiguré soit en résolvant un casse-tête soit en purgeant l'énergie
du satellite se qui prends 1min par 1000PU)
- [ ] Ajout du bloc surchargeur(en combinaison de relais) + identifiant propre Ă  chaque satellite en orbite
Si un joueur souhaite détruire son satellite, il précise l'identifiant et
contre une grande quantité d'énergie, surcharge le satellite et le détruit
- [ ] Ajout de la fusée, remplace l'ancier moyen de deploiement des satellites
- [ ] Ajout du scanner, scan dans son rayon d'action toute créatures hostiles dans
un certain rayon et les désintègres s'il est activé, attention les mobs ne looterons
rien car désintégrés, la vitesse de tir et cependant limité selon les modèles de sat
Quasi instantanée pour la version créa
- [ ] Modification du système de prodution de photon:
Il n'y aura plus de générateur de photon, ni d'emetteur, ni de recepteur
Plusieurs classes de satellite chaque avec des capacités de plus en plus
puissantes selon la classe: Niveau 1 - Defense seulement + lightning
Niveau 2 - Defense et attaque de petit niveau (creeper boom)
Niveau 3 - 2 + Penetring strike + plus de puissance
Niveau X(Crea seulement) - Meteor spawner, et super laser !
- [ ] Ajout de dysfonctionnement du satellite temporaire (réglable) désactivant une certain fonction
cela peut touché: la chambre de tir, les panneaux solaires, les batteries ou le système de visée
- [ ] Un satellite ne peut couvrir qu'une zone de 1000 blocs (sauf créa)
- [ ] Ajout d'une bombe à régéneration, elle permet de regenerer un chunk entier contre 16 enderpearl
et d'une énorme quantité d'énergie !
- [ ] Ajout du satellite de soin, crafté à partir d'une étoile du nether tir
un rayon de soin instantané pour le propriétaire/cible contre de lénergie dans
celui-ci, limité cependant à 100 coeurs, peut être recharger à l'aide
d'une étoile du nether
- [ ] EasterEgg: un tir d'un satellite de soin avec 100 coeurs en réserve sur une
bombe à régénération à pleine puissance, créer une balise
régénératrice de santé illimité mais elle détruit cependant le satellite

View File

@ -1,13 +1,14 @@
buildscript {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://maven.minecraftforge.net/" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1"
classpath("com.anatawa12.forge:ForgeGradle:2.3-1.0.+") {
changing = true
}
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:5.2.+"
}
}
@ -39,94 +40,89 @@ repositories {
url = "http://maven.covers1624.net"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
ext.buildNumber = "0"
if (System.getenv("BUILD_NUMBER") != null) {
buildNumber = System.getenv("BUILD_NUMBER")
}
version = "$baseVersion.$buildNumber"
group = "fr.jackcartersmith.orbsat"
archivesBaseName = "OrbitalSatellite-$project.minecraftVersion"
sourceCompatibility = targetCompatibility = 1.8
compileJava {
sourceCompatibility = targetCompatibility = 1.8
}
minecraft {
ext.buildNumber = "0"
if (System.getenv("BUILD_NUMBER") != null) {
buildNumber = System.getenv("BUILD_NUMBER")
}
version = "$baseVersion.$buildNumber"
group = "fr.jackcartersmith.orbsat"
archivesBaseName = "OrbitalSatellite-$project.minecraftVersion"
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
minecraft {
version = "$project.minecraftVersion-$project.forgeVersion"
runDir = "eclipse"
mappings = "stable_39"
//mappings = "snapshot_20171003"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
compile "mezz.jei:jei_1.12.2:4.10.+:api"
deobfCompile "cofh:RedstoneFlux:1.12-2.1.0.6:universal"
compile "li.cil.oc:OpenComputers:MC1.12.2-1.7.+:api"
compile "mcp.mobius.waila:Hwyla:1.8.26-B41_1.12.2:api"
//compileOnly 'industrial-craft:industrialcraft-2:release:ex112'//'net.industrial-craft:industrialcraft-2:2.8.+'
//compileOnly 'baubles:Baubles:1.12:1.5.2'
}
task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf { // Skip the task if our secret data isn't available
project.hasProperty('keyStore')
}
dependsOn reobfJar
if (project.hasProperty('keyStore')) { // This needs to be a path to the keystore file
keyStore = project.keyStore
alias = project.keyStoreAlias
storePass = project.keyStorePass
keyPass = project.keyStoreKeyPass
inputFile = jar.archivePath
outputFile = jar.archivePath
}
}
mappings = "stable_39"
makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
compile "mezz.jei:jei_1.12.2:4.10.+:api"
deobfCompile "cofh:RedstoneFlux:1.12-2.1.0.7:deobf"
compile "li.cil.oc:OpenComputers:MC1.12.2-1.7.+:api"
compile "mcp.mobius.waila:Hwyla:1.8.26-B41_1.12.2:api"
compileOnly "net.industrial-craft:industrialcraft-2:2.8.+"
compileOnly 'baubles:Baubles:1.12:1.5.2'
}
task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf { // Skip the task if our secret data isn't available
project.hasProperty('keyStore')
}
dependsOn reobfJar
if (project.hasProperty('keyStore')) { // This needs to be a path to the keystore file
keyStore = project.keyStore
alias = project.keyStoreAlias
storePass = project.keyStorePass
keyPass = project.keyStoreKeyPass
inputFile = jar.archivePath
outputFile = jar.archivePath
}
}
build.dependsOn signJar
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include "mcmod.info"
// replace version and mcversion
expand "version": project.version, "mcversion": "1.12.2"
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include "mcmod.info"
// replace version and mcversion
expand "version": project.version, "mcversion": "1.12.2"
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
}
}

View File

@ -2,6 +2,6 @@
# This is required to provide enough memory for the Minecraft decompilation process.
baseVersion=1.0
minecraftVersion=1.12.2
forgeVersion=14.23.5.2838
forgeVersion=14.23.5.2847
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip

File diff suppressed because one or more lines are too long

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -1,63 +1,79 @@
package jackcartersmith.orbsat;
import jackcartersmith.orbsat.common.util.ConfigManager;
import jackcartersmith.orbsat.common.CommonProxy;
import jackcartersmith.orbsat.common.EventHandler;
import jackcartersmith.orbsat.common.OrbsatContents;
import jackcartersmith.orbsat.common.OrbsatSaveData;
import jackcartersmith.orbsat.common.commands.CommandHandler;
import jackcartersmith.orbsat.common.compat.OrbsatCompatModule;
import jackcartersmith.orbsat.common.util.LogHelper;
import jackcartersmith.orbsat.common.util.network.MessageRequestBlockUpdate;
import jackcartersmith.orbsat.common.util.network.MessageTileSync;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
import net.minecraftforge.fml.common.event.FMLModIdMappingEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
import jackcartersmith.orbsat.common.CommonProxy;
import jackcartersmith.orbsat.common.OrbsatBlocks;
import jackcartersmith.orbsat.common.utils.LogHelper;
@Mod(modid = OrbitalSatellite.MODID, name = OrbitalSatellite.NAME, version = OrbitalSatellite.VERSION, modLanguage = "java",
certificateFingerprint = "30f9f06606e9ab799c59ec743cab264c8310531d", dependencies = "required-after:forge@[14.23.5.2838,)")
@Mod(modid = OrbitalSatellite.MODID, name = OrbitalSatellite.NAME, version = OrbitalSatellite.VERSION, modLanguage = "java", guiFactory = OrbitalSatellite.GUI_FACTORY, updateJSON = OrbitalSatellite.UPDATE_JSON,
certificateFingerprint = OrbitalSatellite.FINGERPRINT, dependencies = OrbitalSatellite.DEPENDENCIES)
public class OrbitalSatellite {
public static final String MODID = "orbsat";
public static final String NAME = "Orbital Satellite";
public static final String VERSION = "${version}";
public static final String GUI_FACTORY = "com.raoulvdberge.refinedstorage.gui.config.ModGuiFactory";
public static final String UPDATE_JSON = "https://mcmods.jcsmith.fr/orbsat/versions.json";
public static final String FINGERPRINT = "30f9f06606e9ab799c59ec743cab264c8310531d";
public static final String DEPENDENCIES = "required-after:forge@[14.23.3.2847,);";
@Mod.Instance(MODID)
public static OrbitalSatellite instance = new OrbitalSatellite();
public static OrbitalSatellite INSTANCE = new OrbitalSatellite();
@SidedProxy(clientSide = "jackcartersmith.orbsat.client.ClientProxy", serverSide = "jackcartersmith.orbsat.common.CommonProxy")
public static CommonProxy proxy;
public static CommonProxy PROXY;
public OrbsatConfig config;
public static final SimpleNetworkWrapper packetHandler = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
public static CreativeTabs creativeTab = new CreativeTabs(MODID)
{
@Override
public ItemStack createIcon()
{
return ItemStack.EMPTY;
}
/*@Override
public ItemStack getIcon()
{
return new ItemStack(IEContent.blockMetalDecoration0, 1, 0);
}*/
};
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
LogHelper.logger = event.getModLog();
config = new OrbsatConfig(null, event.getSuggestedConfigurationFile());
PROXY.preInit(event);
/*
ConfigManager.preInit(event);
proxy.init();
OrbsatContents.preInit();
//IEAdvancements.preInit();
OrbsatCompatModule.doModulesPreInit();
*/
}
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
PROXY.init(event);
/*
proxy.preInitEnd();
OrbsatContents.init();
@ -74,23 +90,31 @@ public class OrbitalSatellite {
packetHandler.registerMessage(MessageTileSync.HandlerServer.class, MessageTileSync.class, messageId++, Side.SERVER);
packetHandler.registerMessage(MessageTileSync.HandlerClient.class, MessageTileSync.class, messageId++, Side.CLIENT);
packetHandler.registerMessage(MessageRequestBlockUpdate.Handler.class, MessageRequestBlockUpdate.class, messageId++, Side.SERVER);
*/
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
PROXY.postInit(event);
/*
OrbsatContents.postInit();
proxy.postInit();
OrbsatCompatModule.doModulesPostInit();
proxy.postInitEnd();
*/
}
/*
@Mod.EventHandler
public void loadComplete(FMLLoadCompleteEvent event)
{
OrbsatCompatModule.doModulesLoadComplete();
}
*/
/*
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
@ -108,11 +132,10 @@ public class OrbitalSatellite {
{
LogHelper.info("WorldData loading");
/*
//Clear out any info from previous worlds
for(int dim : ImmersiveNetHandler.INSTANCE.getRelevantDimensions())
ImmersiveNetHandler.INSTANCE.clearAllConnections(dim);
*/
//for(int dim : ImmersiveNetHandler.INSTANCE.getRelevantDimensions())
// ImmersiveNetHandler.INSTANCE.clearAllConnections(dim);
OrbsatSaveData worldData = (OrbsatSaveData)world.loadData(OrbsatSaveData.class, OrbsatSaveData.dataName);
if(worldData==null)
@ -127,29 +150,10 @@ public class OrbitalSatellite {
}
}
}
@Mod.EventHandler
public void modIDMapping(FMLModIdMappingEvent event) {}
public static CreativeTabs creativeTab = new CreativeTabs(MODID)
{
@Override
public ItemStack createIcon()
{
return ItemStack.EMPTY;
}
/*@Override
public ItemStack getIcon()
{
return new ItemStack(IEContent.blockMetalDecoration0, 1, 0);
}*/
};
*/
@Mod.EventHandler
public void wrongSignature(FMLFingerprintViolationEvent event)
{
System.out.println("[OrbSat/Error] THIS IS NOT AN OFFICIAL BUILD OF ORBITAL SATELLITE! Found these fingerprints: "+event.getFingerprints());
public void wrongSignature(FMLFingerprintViolationEvent event) {
System.out.println("[ORBSAT][WARN] THIS IS NOT AN OFFICIAL BUILD OF ORBITAL SATELLITE! The file " + event.getSource().getName() + " may have been tampered with. This version will NOT be supported!");
}
}

View File

@ -0,0 +1,120 @@
package jackcartersmith.orbsat;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.config.IConfigElement;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class OrbsatConfig {
private Configuration config;
private OrbsatConfig originalClientVersion;
//region Controller
public int controllerCapacity;
public boolean controllerUsesEnergy;
//endregion
//region Grid
public int maxRowsStretch;
public boolean largeFont;
public boolean detailedTooltip;
//endregion
//region Wireless Transmitter
public int wirelessTransmitterBaseRange;
public int wirelessTransmitterRangePerUpgrade;
//endregion
//region Wireless Grid
public boolean wirelessGridUsesEnergy;
public int wirelessGridCapacity;
public int wirelessGridOpenUsage;
public int wirelessGridExtractUsage;
public int wirelessGridInsertUsage;
//endregion
//region Categories
private static final String CONTROLLER = "controller";
private static final String GRID = "grid";
private static final String WIRELESS_TRANSMITTER = "wirelessTransmitter";
private static final String WIRELESS_GRID = "wirelessGrid";
//endregion
public OrbsatConfig(@Nullable OrbsatConfig originalClientVersion, File configFile) {
this(originalClientVersion, new Configuration(configFile));
}
public OrbsatConfig(@Nullable OrbsatConfig originalClientVersion, Configuration config) {
this.originalClientVersion = originalClientVersion;
this.config = config;
MinecraftForge.EVENT_BUS.register(this);
this.loadConfig();
}
public Configuration getConfig() {
return config;
}
@Nullable
public OrbsatConfig getOriginalClientVersion() {
return originalClientVersion;
}
@SubscribeEvent
public void onConfigChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.getModID().equalsIgnoreCase(OrbitalSatellite.MODID)) {
loadConfig();
}
}
private void loadConfig() {
//region Controller
controllerCapacity = config.getInt("capacity", CONTROLLER, 32000, 0, Integer.MAX_VALUE, "The energy capacity of the Controller");
controllerUsesEnergy = config.getBoolean("usesEnergy", CONTROLLER, true, "Whether the Controller uses energy");
//endregion
//region Grid
maxRowsStretch = config.getInt("maxRowsStretch", GRID, Integer.MAX_VALUE, 3, Integer.MAX_VALUE, "The maximum amount of rows that the Grid can show when stretched");
largeFont = config.getBoolean("largeFont", GRID, false, "Whether the Grid should use a large font for stack quantity display");
detailedTooltip = config.getBoolean("detailedTooltip", GRID, true, "Whether the Grid should display a detailed tooltip when hovering over an item or fluid");
//endregion
//region Wireless Transmitter
wirelessTransmitterBaseRange = config.getInt("range", WIRELESS_TRANSMITTER, 16, 0, Integer.MAX_VALUE, "The base range of the Wireless Transmitter");
wirelessTransmitterRangePerUpgrade = config.getInt("rangePerUpgrade", WIRELESS_TRANSMITTER, 8, 0, Integer.MAX_VALUE, "The additional range per Range Upgrade in the Wireless Transmitter");
//endregion
//region Wireless Grid
wirelessGridUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_GRID, true, "Whether the Wireless Grid uses energy");
wirelessGridCapacity = config.getInt("capacity", WIRELESS_GRID, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Wireless Grid");
wirelessGridOpenUsage = config.getInt("open", WIRELESS_GRID, 30, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to open");
wirelessGridInsertUsage = config.getInt("insert", WIRELESS_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to insert items");
wirelessGridExtractUsage = config.getInt("extract", WIRELESS_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Wireless Grid to extract items");
//endregion
if (config.hasChanged()) {
config.save();
}
}
public List<IConfigElement> getConfigElements() {
List<IConfigElement> list = new ArrayList<>();
list.add(new ConfigElement(config.getCategory(CONTROLLER)));
list.add(new ConfigElement(config.getCategory(WIRELESS_TRANSMITTER)));
list.add(new ConfigElement(config.getCategory(GRID)));
list.add(new ConfigElement(config.getCategory(WIRELESS_GRID)));
return list;
}
}

View File

@ -1,10 +1,76 @@
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;
}
package jackcartersmith.orbsat.client;
import java.util.function.Function;
import java.util.function.Supplier;
import jackcartersmith.orbsat.client.render.IModelRegistration;
import jackcartersmith.orbsat.common.CommonProxy;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ICustomModelLoader;
public class ClientProxy extends CommonProxy implements IModelRegistration {
@Override
public void addBakedModelOverride(ResourceLocation resource, Function<IBakedModel, IBakedModel> override) {
// TODO Auto-generated method stub
}
@Override
public void setModel(Block block, int meta, ModelResourceLocation resource) {
// TODO Auto-generated method stub
}
@Override
public void setModel(Item item, int meta, ModelResourceLocation resource) {
// TODO Auto-generated method stub
}
@Override
public void setModelVariants(Item item, ResourceLocation... variants) {
// TODO Auto-generated method stub
}
@Override
public void setModelMeshDefinition(Block block, ItemMeshDefinition meshDefinition) {
// TODO Auto-generated method stub
}
@Override
public void addModelLoader(Supplier<ICustomModelLoader> modelLoader) {
// TODO Auto-generated method stub
}
@Override
public void setStateMapper(Block block, IStateMapper stateMapper) {
// TODO Auto-generated method stub
}
@Override
public void setTesr(Class<? extends TileEntity> tile, TileEntitySpecialRenderer tesr) {
// TODO Auto-generated method stub
}
@Override
public void addItemColor(Item item, IItemColor itemColor) {
// TODO Auto-generated method stub
}
}

View File

@ -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)&&timestamp >= 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;
}
}

View File

@ -0,0 +1,37 @@
package jackcartersmith.orbsat.client.render;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ICustomModelLoader;
public interface IModelRegistration {
void addBakedModelOverride(ResourceLocation resource, Function<IBakedModel, IBakedModel> override);
void setModel(Block block, int meta, ModelResourceLocation resource);
void setModel(Item item, int meta, ModelResourceLocation resource);
void setModelVariants(Item item, ResourceLocation... variants);
void setModelMeshDefinition(Block block, ItemMeshDefinition meshDefinition);
// Supplier needed to avoid server crash.
void addModelLoader(Supplier<ICustomModelLoader> modelLoader);
void setStateMapper(Block block, IStateMapper stateMapper);
void setTesr(Class<? extends TileEntity> tile, TileEntitySpecialRenderer tesr);
void addItemColor(Item item, IItemColor itemColor);
}

View File

@ -0,0 +1,210 @@
package jackcartersmith.orbsat.common;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import jackcartersmith.orbsat.OrbitalSatellite;
import jackcartersmith.orbsat.client.render.IModelRegistration;
import jackcartersmith.orbsat.common.blocks.collision.AdvancedRayTraceResult;
import jackcartersmith.orbsat.common.blocks.collision.AdvancedRayTracer;
import jackcartersmith.orbsat.common.blocks.collision.CollisionGroup;
import jackcartersmith.orbsat.common.blocks.info.BlockDirection;
import jackcartersmith.orbsat.common.blocks.info.IBlockInfo;
import jackcartersmith.orbsat.common.items.itemblocks.ItemBlockOrbsatBase;
import jackcartersmith.orbsat.common.tileentities.TileEntityOrbsatBase;
import jackcartersmith.orbsat.common.utils.CollisionUtils;
import jackcartersmith.orbsat.common.utils.WorldUtils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class BlockOrbsatBase extends Block {
private static final CollisionGroup DEFAULT_COLLISION_GROUP = new CollisionGroup().addItem(new AxisAlignedBB(0, 0, 0, 1, 1, 1)).setCanAccessGui(true);
private static final List<CollisionGroup> DEFAULT_COLLISION_GROUPS = Collections.singletonList(DEFAULT_COLLISION_GROUP);
protected final IBlockInfo info;
public BlockOrbsatBase(IBlockInfo info) {
super(info.getMaterial());
this.info = info;
setHardness(info.getHardness());
setRegistryName(info.getId());
setCreativeTab(OrbitalSatellite.INSTANCE.creativeTab);
setSoundType(info.getSoundType());
}
@SideOnly(Side.CLIENT)
public void registerModels(IModelRegistration modelRegistration) {}
@Override
public String getTranslationKey() {
return "block." + info.getId().toString();
}
protected BlockStateContainer.Builder createBlockStateBuilder() {
BlockStateContainer.Builder builder = new BlockStateContainer.Builder(this);
if (getDirection() != null) {
builder.add(getDirection().getProperty());
}
return builder;
}
@Override
protected BlockStateContainer createBlockState() {
return createBlockStateBuilder().build();
}
public Item createItem() {
return new ItemBlockOrbsatBase(this, false);
}
public IBlockState getStateFromMeta(int meta) {
return getDefaultState();
}
@Override
public int getMetaFromState(IBlockState state) {
return 0;
}
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
if (getDirection() != null) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityOrbsatBase) {
return state.withProperty(getDirection().getProperty(), ((TileEntityOrbsatBase) tile).getDirection());
}
}
return state;
}
@Override
public int damageDropped(IBlockState state) {
return getMetaFromState(state);
}
@Override
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
if (!world.isRemote && getDirection() != null) {
TileEntityOrbsatBase tile = (TileEntityOrbsatBase) world.getTileEntity(pos);
EnumFacing newDirection = getDirection().cycle(tile.getDirection());
tile.setDirection(newDirection);
WorldUtils.updateBlock(world, pos);
return true;
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
dropContents(world, pos);
removeTile(world, pos, state);
}
void removeTile(World world, BlockPos pos, IBlockState state) {
if (hasTileEntity(state)) {
world.removeTileEntity(pos);
}
}
void dropContents(World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityOrbsatBase && ((TileEntityOrbsatBase) tile).getDrops() != null) {
WorldUtils.dropInventory(world, pos, ((TileEntityOrbsatBase) tile).getDrops());
}
}
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
return willHarvest || super.removedByPlayer(state, world, pos, player, willHarvest);
}
@Override
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity tile, ItemStack stack) {
super.harvestBlock(world, player, pos, state, tile, stack);
world.setBlockToAir(pos);
}
@Override
public final boolean hasTileEntity(IBlockState state) {
return info.hasTileEntity();
}
@Override
public final TileEntity createTileEntity(World world, IBlockState state) {
return info.createTileEntity();
}
@Nullable
public BlockDirection getDirection() {
return null;
}
public final IBlockInfo getInfo() {
return info;
}
protected boolean canAccessGui(IBlockState state, World world, BlockPos pos, float hitX, float hitY, float hitZ) {
state = getActualState(state, world, pos);
for (CollisionGroup group : getCollisions(world.getTileEntity(pos), state)) {
if (group.canAccessGui()) {
for (AxisAlignedBB aabb : group.getItems()) {
if (CollisionUtils.isInBounds(aabb, hitX, hitY, hitZ)) {
return true;
}
}
}
}
return false;
}
public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) {
return DEFAULT_COLLISION_GROUPS;
}
@Override
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
for (CollisionGroup group : getCollisions(world.getTileEntity(pos), this.getActualState(state, world, pos))) {
for (AxisAlignedBB aabb : group.getItems()) {
state.addCollisionBoxToList(world, pos, entityBox, collidingBoxes, entityIn, isActualState);
}
}
}
@Override
public RayTraceResult collisionRayTrace(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) {
AdvancedRayTraceResult result = AdvancedRayTracer.rayTrace(pos, start, end, getCollisions(world.getTileEntity(pos), this.getActualState(state, world, pos)));
return result != null ? result.getHit() : null;
}
}

View File

@ -1,237 +1,211 @@
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()
{
}
}
package jackcartersmith.orbsat.common;
import java.util.LinkedList;
import java.util.List;
import jackcartersmith.orbsat.OrbitalSatellite;
import jackcartersmith.orbsat.common.blocks.info.IBlockInfo;
import jackcartersmith.orbsat.common.tileentities.TileEntityOrbsatBase;
import jackcartersmith.orbsat.common.utils.MessageConfigSync;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class CommonProxy {
protected List<Item> itemsToRegister = new LinkedList<>();
protected List<BlockOrbsatBase> blocksToRegister = new LinkedList<>();
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
/*
* REGISTER NETWORK PACKET HERE!
*/
/*
int id = 0;
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageTileDataParameter.class, MessageTileDataParameter.class, id++, Side.CLIENT);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageTileDataParameterUpdate.class, MessageTileDataParameterUpdate.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageGridItemInsertHeld.class, MessageGridItemInsertHeld.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageGridItemPull.class, MessageGridItemPull.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageGridClear.class, MessageGridClear.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageGridTransfer.class, MessageGridTransfer.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageGridSettingsUpdate.class, MessageGridSettingsUpdate.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageGridCraftingStart.class, MessageGridCraftingStart.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageGridPatternCreate.class, MessageGridPatternCreate.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageCraftingMonitorCancel.class, MessageCraftingMonitorCancel.class, id++, Side.SERVER);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageCraftingMonitorElements.class, MessageCraftingMonitorElements.class, id++, Side.CLIENT);
OrbitalSatellite.INSTANCE.packetHandler.registerMessage(MessageGridItemUpdate.class, MessageGridItemUpdate.class, id++, Side.CLIENT);
*/
/*
* REGISTER THE GUI HANDLER (Dispatcher between all mod's GUI when you clic a block)
*/
//NetworkRegistry.INSTANCE.registerGuiHandler(OrbitalSatellite.INSTANCE, new GuiHandler());
/*
* REGISTER BLOCKS HERE!
*/
registerBlock(OrbsatBlocks.BLOCK_CRYSTAL);
/*
* REGISTER ITEMS HERE!
*/
//registerItem(OrbsatItems.QUARTZ_ENRICHED_IRON);
//registerItem(OrbsatItems.PROCESSOR_BINDING);
}
public void init(FMLInitializationEvent event) {
/*
* REGISTER SMELTING HERE!
*/
/*
GameRegistry.addSmelting(Items.QUARTZ, new ItemStack(RSItems.SILICON), 0.5F);
GameRegistry.addSmelting(new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_CUT_BASIC), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC), 0.5F);
GameRegistry.addSmelting(new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_CUT_IMPROVED), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED), 0.5F);
GameRegistry.addSmelting(new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_CUT_ADVANCED), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), 0.5F);
*/
/*
* Integration with other mods like OC
*/
/*
if (IntegrationOC.isLoaded()) {
DriverNetwork.register();
}
*/
}
public void postInit(FMLPostInitializationEvent event) {}
private void registerBlock(BlockOrbsatBase block) {
blocksToRegister.add(block);
registerItem(block.createItem());
if (block.getInfo().hasTileEntity()) {
registerTile(block.getInfo());
}
}
private void registerItem(Item item) {
itemsToRegister.add(item);
}
@SubscribeEvent
public void registerBlocks(RegistryEvent.Register<Block> event) {
blocksToRegister.forEach(event.getRegistry()::register);
}
private void registerTile(IBlockInfo info) {
Class<? extends TileEntityOrbsatBase> clazz = info.createTileEntity().getClass();
GameRegistry.registerTileEntity(clazz, info.getId());
/*
try {
TileEntityOrbsatBase tileInstance = clazz.newInstance();
if (tileInstance instanceof TileNode) {
API.instance().getNetworkNodeRegistry().add(((TileNode) tileInstance).getNodeId(), (tag, world, pos) -> {
NetworkNode node = ((TileNode) tileInstance).createNode(world, pos);
node.read(tag);
return node;
});
}
tileInstance.getDataManager().getParameters().forEach(TileDataManager::registerParameter);
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
*/
}
@SubscribeEvent
public void registerItems(RegistryEvent.Register<Item> event) {
itemsToRegister.forEach(event.getRegistry()::register);
/*
* REGISTER NEW ORES HERE!
*/
//OreDictionary.registerOre("itemSilicon", RSItems.SILICON);
}
@SubscribeEvent
public void registerRecipes(RegistryEvent.Register<IRecipe> event) {
/*
* REGISTER SPECIALS RECIPES HERE!
*/
/*
e.getRegistry().register(new RecipeCover().setRegistryName(new ResourceLocation(RS.ID, "cover")));
e.getRegistry().register(new RecipeHollowCover().setRegistryName(new ResourceLocation(RS.ID, "hollow_cover")));
e.getRegistry().register(new RecipeUpgradeWithEnchantedBook("fortune", 1, ItemUpgrade.TYPE_FORTUNE_1).setRegistryName(new ResourceLocation(RS.ID, "fortune_1_upgrade")));
e.getRegistry().register(new RecipeUpgradeWithEnchantedBook("fortune", 2, ItemUpgrade.TYPE_FORTUNE_2).setRegistryName(new ResourceLocation(RS.ID, "fortune_2_upgrade")));
e.getRegistry().register(new RecipeUpgradeWithEnchantedBook("fortune", 3, ItemUpgrade.TYPE_FORTUNE_3).setRegistryName(new ResourceLocation(RS.ID, "fortune_3_upgrade")));
e.getRegistry().register(new RecipeUpgradeWithEnchantedBook("silk_touch", 1, ItemUpgrade.TYPE_SILK_TOUCH).setRegistryName(new ResourceLocation(RS.ID, "silk_touch_upgrade")));
*/
}
@SubscribeEvent
public void onHarvestCheck(PlayerEvent.HarvestCheck event) {
if (event.getTargetBlock().getBlock() instanceof Block) {
event.setCanHarvest(true); // Allow break without tool
}
}
@SubscribeEvent
public void onPlayerLoginEvent(net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent event) {
if (!event.player.world.isRemote) {
OrbitalSatellite.INSTANCE.packetHandler.sendTo(new MessageConfigSync(), (EntityPlayerMP) event.player); // Sync config between server and client?
}
}
@SubscribeEvent
public void onPlayerLogoutEvent(WorldEvent.Unload event) {
if (event.getWorld().isRemote && OrbitalSatellite.INSTANCE.config.getOriginalClientVersion() != null) {
OrbitalSatellite.INSTANCE.config = OrbitalSatellite.INSTANCE.config.getOriginalClientVersion();
}
}
/*
@SubscribeEvent
public void fixItemMappings(RegistryEvent.MissingMappings<Item> e) {
// MANAGE SPECIAL UPDATE WITH MISSING MAPPING DU TO REMOVAL
for (RegistryEvent.MissingMappings.Mapping<Item> missing : e.getMappings()) {
if (missing.key.getNamespace().equals(OrbitalSatellite.MODID) && missing.key.getPath().equals("solderer")) {
missing.ignore();
}
}
}
@SubscribeEvent
public void fixBlockMappings(RegistryEvent.MissingMappings<Block> e) {
// MANAGE SPECIAL UPDATE WITH MISSING MAPPING DU TO REMOVAL
for (RegistryEvent.MissingMappings.Mapping<Block> missing : e.getMappings()) {
if (missing.key.getNamespace().equals(OrbitalSatellite.MODID) && missing.key.getPath().equals("solderer")) {
missing.ignore();
}
}
}
*/
}

View File

@ -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)
{
}
}

View File

@ -0,0 +1,10 @@
package jackcartersmith.orbsat.common;
import jackcartersmith.orbsat.common.blocks.BlockCrystal;
import net.minecraft.block.Block;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public final class OrbsatBlocks {
public static final BlockCrystal BLOCK_CRYSTAL = new BlockCrystal();
}

View File

@ -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(){
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,26 @@
package jackcartersmith.orbsat.common.blocks;
import jackcartersmith.orbsat.OrbitalSatellite;
import jackcartersmith.orbsat.client.render.IModelRegistration;
import jackcartersmith.orbsat.common.BlockOrbsatBase;
import jackcartersmith.orbsat.common.blocks.info.BlockInfoBuilder;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockCrystal extends BlockOrbsatBase {
public BlockCrystal() {
super(BlockInfoBuilder.forId("block_crystal").create());
setLightOpacity(5);
}
@Override
@SideOnly(Side.CLIENT)
public void registerModels(IModelRegistration modelRegistration) {
modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory"));
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}
}

View File

@ -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();
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,37 @@
package jackcartersmith.orbsat.common.blocks.collision;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
public class AdvancedRayTraceResult<T extends RayTraceResult> {
private CollisionGroup group;
private AxisAlignedBB bounds;
private T hit;
public AdvancedRayTraceResult(CollisionGroup group, AxisAlignedBB bounds, T hit) {
this.group = group;
this.bounds = bounds;
this.hit = hit;
}
public boolean valid() {
return hit != null && bounds != null;
}
public double squareDistanceTo(Vec3d vec) {
return hit.hitVec.squareDistanceTo(vec);
}
public CollisionGroup getGroup() {
return group;
}
public AxisAlignedBB getBounds() {
return bounds;
}
public T getHit() {
return hit;
}
}

View File

@ -0,0 +1,66 @@
package jackcartersmith.orbsat.common.blocks.collision;
import java.util.Collection;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
public final class AdvancedRayTracer {
public static Vec3d getStart(EntityPlayer player) {
return new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
}
public static Vec3d getEnd(EntityPlayer player) {
double reachDistance = player instanceof EntityPlayerMP ? player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue() : (player.capabilities.isCreativeMode ? 5.0D : 4.5D);
Vec3d lookVec = player.getLookVec();
Vec3d start = getStart(player);
return start.add(lookVec.x * reachDistance, lookVec.y * reachDistance, lookVec.z * reachDistance);
}
@Nullable
public static AdvancedRayTraceResult<RayTraceResult> rayTrace(BlockPos pos, Vec3d start, Vec3d end, Collection<CollisionGroup> groups) {
double minDistance = Double.POSITIVE_INFINITY;
AdvancedRayTraceResult hit = null;
int i = -1;
for (CollisionGroup group : groups) {
for (AxisAlignedBB aabb : group.getItems()) {
AdvancedRayTraceResult result = rayTrace(pos, start, end, aabb, i, group);
if (result != null) {
double d = result.squareDistanceTo(start);
if (d < minDistance) {
minDistance = d;
hit = result;
}
}
i++;
}
}
return hit;
}
public static AdvancedRayTraceResult<RayTraceResult> rayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB bounds, int subHit, CollisionGroup group) {
RayTraceResult result = bounds.offset(pos).calculateIntercept(start, end);
if (result == null) {
return null;
}
result = new RayTraceResult(RayTraceResult.Type.BLOCK, result.hitVec, result.sideHit, pos);
result.subHit = subHit;
return new AdvancedRayTraceResult<>(group, bounds, result);
}
}

View File

@ -0,0 +1,47 @@
package jackcartersmith.orbsat.common.blocks.collision;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
public class CollisionGroup {
private List<AxisAlignedBB> items = new ArrayList<>();
private boolean canAccessGui;
@Nullable
private EnumFacing direction;
public CollisionGroup addItem(AxisAlignedBB item) {
items.add(item);
return this;
}
public List<AxisAlignedBB> getItems() {
return items;
}
public boolean canAccessGui() {
return canAccessGui;
}
public CollisionGroup setCanAccessGui(boolean canAccessGui) {
this.canAccessGui = canAccessGui;
return this;
}
public CollisionGroup setDirection(EnumFacing direction) {
this.direction = direction;
return this;
}
@Nullable
public EnumFacing getDirection() {
return direction;
}
}

View File

@ -0,0 +1,49 @@
package jackcartersmith.orbsat.common.blocks.info;
import java.util.Arrays;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
public enum BlockDirection {
ANY(EnumFacing.VALUES),
ANY_FACE_PLAYER(EnumFacing.VALUES),
HORIZONTAL(EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST);
private final PropertyDirection property;
BlockDirection(EnumFacing... allowed) {
this.property = PropertyDirection.create("direction", Arrays.asList(allowed));
}
public PropertyDirection getProperty() {
return property;
}
public EnumFacing getFrom(EnumFacing facing, BlockPos pos, EntityLivingBase entity) {
switch (this) {
case ANY:
return facing.getOpposite();
case ANY_FACE_PLAYER:
return EnumFacing.getDirectionFromEntityLiving(pos, entity);
case HORIZONTAL:
return entity.getHorizontalFacing().getOpposite();
default:
return null;
}
}
public EnumFacing cycle(EnumFacing previous) {
switch (this) {
case ANY:
case ANY_FACE_PLAYER:
return previous.ordinal() + 1 >= EnumFacing.VALUES.length ? EnumFacing.VALUES[0] : EnumFacing.VALUES[previous.ordinal() + 1];
case HORIZONTAL:
return previous.rotateYCCW();
default:
return previous;
}
}
}

View File

@ -0,0 +1,65 @@
package jackcartersmith.orbsat.common.blocks.info;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import jackcartersmith.orbsat.common.tileentities.TileEntityOrbsatBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.util.ResourceLocation;
public class BlockInfo implements IBlockInfo {
private final Material material;
private final SoundType soundType;
private final float hardness;
private final ResourceLocation id;
private final Object modObject;
@Nullable
private final Supplier<TileEntityOrbsatBase> tileSupplier;
public BlockInfo(Material material, SoundType soundType, float hardness, String id, String modId, Object modObject, Supplier<TileEntityOrbsatBase> tileSupplier) {
this.material = material;
this.soundType = soundType;
this.hardness = hardness;
this.id = new ResourceLocation(modId, id);
this.modObject = modObject;
this.tileSupplier = tileSupplier;
}
@Override
public Material getMaterial() {
return material;
}
@Override
public SoundType getSoundType() {
return soundType;
}
@Override
public ResourceLocation getId() {
return id;
}
@Override
public Object getModObject() {
return modObject;
}
@Override
public float getHardness() {
return hardness;
}
@Nullable
@Override
public TileEntityOrbsatBase createTileEntity() {
return tileSupplier.get();
}
@Override
public boolean hasTileEntity() {
return tileSupplier != null;
}
}

View File

@ -0,0 +1,63 @@
package jackcartersmith.orbsat.common.blocks.info;
import java.util.function.Supplier;
import jackcartersmith.orbsat.OrbitalSatellite;
import jackcartersmith.orbsat.common.tileentities.TileEntityOrbsatBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
public final class BlockInfoBuilder {
private Material material = Material.ROCK;
private String id;
private String modId;
private Object modObject;
private float hardness = 1.9F;
private SoundType soundType = SoundType.STONE;
private Supplier<TileEntityOrbsatBase> tileSupplier;
private BlockInfoBuilder() {
}
public static BlockInfoBuilder forMod(Object modObject, String modId, String id) {
BlockInfoBuilder builder = new BlockInfoBuilder();
builder.modObject = modObject;
builder.modId = modId;
builder.id = id;
return builder;
}
public static BlockInfoBuilder forId(String id) {
return forMod(OrbitalSatellite.INSTANCE, OrbitalSatellite.MODID, id);
}
public BlockInfoBuilder material(Material material) {
this.material = material;
return this;
}
public BlockInfoBuilder soundType(SoundType soundType) {
this.soundType = soundType;
return this;
}
public BlockInfoBuilder hardness(float hardness) {
this.hardness = hardness;
return this;
}
public BlockInfoBuilder tileEntity(Supplier<TileEntityOrbsatBase> tileSupplier) {
this.tileSupplier = tileSupplier;
return this;
}
public BlockInfo create() {
return new BlockInfo(material, soundType, hardness, id, modId, modObject, tileSupplier);
}
}

View File

@ -0,0 +1,25 @@
package jackcartersmith.orbsat.common.blocks.info;
import javax.annotation.Nullable;
import jackcartersmith.orbsat.common.tileentities.TileEntityOrbsatBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.util.ResourceLocation;
public interface IBlockInfo {
Material getMaterial();
SoundType getSoundType();
ResourceLocation getId();
Object getModObject();
float getHardness();
@Nullable
TileEntityOrbsatBase createTileEntity();
boolean hasTileEntity();
}

View File

@ -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]));
}
}

View File

@ -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;
}
}

View File

@ -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() {}
}

View File

@ -1,7 +0,0 @@
package jackcartersmith.orbsat.common.compat;
import mcp.mobius.waila.api.IWailaDataProvider;
public class OrbsatWailaDataProvider implements IWailaDataProvider {
//TODO
}

View File

@ -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()
{
}
}

View File

@ -0,0 +1,5 @@
package jackcartersmith.orbsat.common.items;
public class ItemOrbsatBase {
}

View File

@ -0,0 +1,59 @@
package jackcartersmith.orbsat.common.items.itemblocks;
import jackcartersmith.orbsat.common.BlockOrbsatBase;
import jackcartersmith.orbsat.common.tileentities.TileEntityOrbsatBase;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ItemBlockOrbsatBase extends ItemBlock {
private BlockOrbsatBase block;
public ItemBlockOrbsatBase(BlockOrbsatBase block, boolean subtypes) {
super(block);
this.block = block;
setRegistryName(block.getInfo().getId());
if (subtypes) {
setMaxDamage(0);
setHasSubtypes(true);
}
}
@Override
public int getMetadata(int damage) {
return damage;
}
@Override
public String getTranslationKey(ItemStack stack) {
if (getHasSubtypes()) {
return getTranslationKey() + "." + stack.getItemDamage();
}
return getTranslationKey();
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
boolean result = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
if (result && block.getDirection() != null) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityOrbsatBase) {
((TileEntityOrbsatBase) tile).setDirection(block.getDirection().getFrom(side, pos, player));
}
}
return result;
}
}

View File

@ -0,0 +1,127 @@
package jackcartersmith.orbsat.common.tileentities;
import javax.annotation.Nullable;
import jackcartersmith.orbsat.common.utils.DirectionHandlerTile;
import jackcartersmith.orbsat.common.utils.IDirectionHandler;
import jackcartersmith.orbsat.common.utils.WorldUtils;
import net.minecraft.block.state.IBlockState;
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.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
public abstract class TileEntityOrbsatBase extends TileEntity {
protected static final String NBT_DIRECTION = "Direction";
private EnumFacing clientDirection = EnumFacing.NORTH;
protected IDirectionHandler directionHandler = new DirectionHandlerTile();
//protected TileDataManager dataManager = new TileDataManager(this);
public void setDirection(EnumFacing direction) {
clientDirection = direction;
directionHandler.setDirection(direction);
world.notifyNeighborsOfStateChange(pos, world.getBlockState(pos).getBlock(), true);
markDirty();
}
public EnumFacing getDirection() {
return world.isRemote ? clientDirection : directionHandler.getDirection();
}
/*
public TileDataManager getDataManager() {
return dataManager;
}
*/
public NBTTagCompound write(NBTTagCompound tag) {
directionHandler.writeToTileNbt(tag);
return tag;
}
public NBTTagCompound writeUpdate(NBTTagCompound tag) {
tag.setInteger(NBT_DIRECTION, directionHandler.getDirection().ordinal());
return tag;
}
public void read(NBTTagCompound tag) {
directionHandler.readFromTileNbt(tag);
}
public void readUpdate(NBTTagCompound tag) {
boolean doRender = canCauseRenderUpdate(tag);
clientDirection = EnumFacing.byIndex(tag.getInteger(NBT_DIRECTION));
if (doRender) {
WorldUtils.updateBlock(world, pos);
}
}
protected boolean canCauseRenderUpdate(NBTTagCompound tag) {
return true;
}
@Override
public final NBTTagCompound getUpdateTag() {
return writeUpdate(super.getUpdateTag());
}
@Nullable
@Override
public final SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(pos, 1, getUpdateTag());
}
@Override
public final void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
readUpdate(packet.getNbtCompound());
}
@Override
public final void handleUpdateTag(NBTTagCompound tag) {
super.readFromNBT(tag);
readUpdate(tag);
}
@Override
public final void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
read(tag);
}
@Override
public final NBTTagCompound writeToNBT(NBTTagCompound tag) {
return write(super.writeToNBT(tag));
}
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
return oldState.getBlock() != newState.getBlock();
}
@Nullable
public IItemHandler getDrops() {
return null;
}
// @Volatile: Copied with some changes from the super method (avoid sending neighbor updates, it's not needed)
@Override
public void markDirty() {
if (world != null) {
world.markChunkDirty(pos, this);
}
}
}

View File

@ -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()
{
}
}

View File

@ -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;
}

View File

@ -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;
}
}
}

View File

@ -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();
}
};
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -0,0 +1,13 @@
package jackcartersmith.orbsat.common.utils;
import net.minecraft.util.math.AxisAlignedBB;
public final class CollisionUtils {
public static AxisAlignedBB getBounds(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) {
return new AxisAlignedBB((float) fromX / 16F, (float) fromY / 16F, (float) fromZ / 16F, (float) toX / 16F, (float) toY / 16F, (float) toZ / 16F);
}
public static boolean isInBounds(AxisAlignedBB aabb, float hitX, float hitY, float hitZ) {
return hitX >= aabb.minX && hitX <= aabb.maxX && hitY >= aabb.minY && hitY <= aabb.maxY && hitZ >= aabb.minZ && hitZ <= aabb.maxZ;
}
}

View File

@ -0,0 +1,32 @@
package jackcartersmith.orbsat.common.utils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
public class DirectionHandlerTile implements IDirectionHandler {
public static final String NBT_DIRECTION = "Direction";
private EnumFacing direction = EnumFacing.NORTH;
@Override
public void setDirection(EnumFacing direction) {
this.direction = direction;
}
@Override
public EnumFacing getDirection() {
return direction;
}
@Override
public void writeToTileNbt(NBTTagCompound tag) {
tag.setInteger(NBT_DIRECTION, direction.ordinal());
}
@Override
public void readFromTileNbt(NBTTagCompound tag) {
if (tag.hasKey(NBT_DIRECTION)) {
direction = EnumFacing.byIndex(tag.getInteger(NBT_DIRECTION));
}
}
}

View File

@ -0,0 +1,14 @@
package jackcartersmith.orbsat.common.utils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
public interface IDirectionHandler {
void setDirection(EnumFacing direction);
EnumFacing getDirection();
void writeToTileNbt(NBTTagCompound tag);
void readFromTileNbt(NBTTagCompound tag);
}

View File

@ -1,47 +1,43 @@
/*
* 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);
}
}
package jackcartersmith.orbsat.common.utils;
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);
}
}

View File

@ -0,0 +1,32 @@
package jackcartersmith.orbsat.common.utils;
import io.netty.buffer.ByteBuf;
import jackcartersmith.orbsat.OrbitalSatellite;
import jackcartersmith.orbsat.OrbsatConfig;
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 MessageConfigSync implements IMessage, IMessageHandler<MessageConfigSync, IMessage> {
@Override
public void fromBytes(ByteBuf buf) {
OrbsatConfig serverVersion = new OrbsatConfig(OrbitalSatellite.INSTANCE.config, OrbitalSatellite.INSTANCE.config.getConfig());
serverVersion.controllerCapacity = buf.readInt();
serverVersion.wirelessGridCapacity = buf.readInt();
OrbitalSatellite.INSTANCE.config = serverVersion;
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(OrbitalSatellite.INSTANCE.config.controllerCapacity);
buf.writeInt(OrbitalSatellite.INSTANCE.config.wirelessGridCapacity);
}
@Override
public IMessage onMessage(MessageConfigSync message, MessageContext ctx) {
return null;
}
}

View File

@ -0,0 +1,57 @@
package jackcartersmith.orbsat.common.utils;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.InvWrapper;
import net.minecraftforge.items.wrapper.SidedInvWrapper;
public final class WorldUtils {
public static void updateBlock(@Nullable World world, BlockPos pos) {
if (world != null) {
IBlockState state = world.getBlockState(pos);
world.notifyBlockUpdate(pos, state, state, 1 | 2);
}
}
public static IItemHandler getItemHandler(@Nullable TileEntity tile, EnumFacing side) {
if (tile == null) {
return null;
}
IItemHandler handler = tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side) ? tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side) : null;
if (handler == null) {
if (side != null && tile instanceof ISidedInventory) {
handler = new SidedInvWrapper((ISidedInventory) tile, side);
} else if (tile instanceof IInventory) {
handler = new InvWrapper((IInventory) tile);
}
}
return handler;
}
public static void dropInventory(World world, BlockPos pos, IItemHandler handler) {
for (int i = 0; i < handler.getSlots(); ++i) {
if (!handler.getStackInSlot(i).isEmpty()) {
InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), handler.getStackInSlot(i));
}
}
}
}

View File

@ -0,0 +1,2 @@
itemGroup.orbsat=Orbital Satellite
tile.orbsat:crystalblock.name=Crystal Block

View File

@ -2,13 +2,14 @@
{
"modid": "orbsat",
"name": "Orbital Satellite",
"description": "Multi-usage satellite with control center and launch bay.",
"version": "0.1.3",
"description": "Use orbital satellite to enhance your gameplay: teleport, defense, heal, scan...",
"version": "0.0.1",
"mcversion": "${mcversion}",
"url": "",
"url": "https://mcmods.jcsmith.fr/orbsat/",
"updateJSON": "https://mcmods.jcsmith.fr/orbsat/versions.json",
"authorList": ["JackCarterSmith"],
"credits": "Thanks for Forge community, Discord and BluSunrize!",
"logoFile": "",
"logoFile": "assets/orbsat/textures/logo.png",
"dependencies": []
}
]

10
versions.json Normal file
View 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",
}
}