Prepare for 1.12.2 support, lose 1.10.2

This commit is contained in:
JackCarterSmith 2018-09-16 14:15:17 +02:00
parent f00987a123
commit 9d731daac6
91 changed files with 220 additions and 6571 deletions

View File

@ -1 +0,0 @@
theme: jekyll-theme-slate

View File

@ -1,96 +1,82 @@
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.
version = "0.1"
group= "fr.jackcartersmith.orbsat" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "orbsat"
sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
}
minecraft {
version = "12.18.3.2185"
mappings = "snapshot_20161111"
runDir = "run"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not allways work.
// simply re-run your setup task after changing the mappings to update your workspace.
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
repositories {
maven { // WAILA
name "ProfMobius Maven FS"
url "http://mobiusstrip.eu/maven"
}
maven { // OpenComputers
name "OpenComputers"
url "http://maven.cil.li/"
}
// maven { // McJty's CompatLayer
// name 'K4 maven'
// url "http://maven.k-4u.nl/"
// }
}
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
// deobfCompile "com.github.mcjty:compatlayer:1.10-0.+"
deobfCompile "li.cil.oc:OpenComputers:MC1.10.2-1.6.0.+"
deobfCompile "mcp.mobius.waila:Waila:1.7.0-B3_1.9.4"
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
version = "3.0"
group = "fr.jackcartersmith.orbsat" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "orbsat"
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12.2-14.23.4.2705"
runDir = "run"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "stable_39"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
repositories {
maven { url = "http://maven.cil.li/" }
}
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"
compile "li.cil.oc:OpenComputers:MC1.12.2-1.7.+:api"
// 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
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}

3
gradle.properties Normal file
View File

@ -0,0 +1,3 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Wed Jul 02 15:54:47 CDT 2014
#Mon Sep 14 12:28:28 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip

180
gradlew.bat vendored
View File

@ -1,90 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1,31 @@
package com.example.examplemod;
import net.minecraft.init.Blocks;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.Logger;
@Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION)
public class ExampleMod
{
public static final String MODID = "examplemod";
public static final String NAME = "Example Mod";
public static final String VERSION = "1.0";
private static Logger logger;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
logger = event.getModLog();
}
@EventHandler
public void init(FMLInitializationEvent event)
{
// some example code
logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}
}

View File

@ -1,15 +0,0 @@
package fr.jackcartersmith.orbsat;
import fr.jackcartersmith.orbsat.block.BlockOSBase;
import fr.jackcartersmith.orbsat.block.BlockType_Devices;
import fr.jackcartersmith.orbsat.block.ItemBlockOSBase;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
public class OSBlocks {
public static BlockOSBase devices;
public static void init(){
devices = (BlockOSBase)new BlockOSBase("devices", Material.IRON, PropertyEnum.create("type", BlockType_Devices.class), ItemBlockOSBase.class).setOpaque(true).setHardness(2.0F).setResistance(5.0F);
}
}

View File

@ -1,37 +0,0 @@
package fr.jackcartersmith.orbsat;
import java.util.Locale;
import net.minecraft.util.IStringSerializable;
public class OSEnums {
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,16 +0,0 @@
package fr.jackcartersmith.orbsat;
import fr.jackcartersmith.orbsat.item.ItemOSBase;
public class OSItems {
public static ItemOSBase componentsItem;
public static ItemOSBase satelliteItem;
public static void init(){
componentsItem = new ItemOSBase("components",3,
"laserDesignator","designatorCircuit",
"photonLens","photonConcentrator","photonCapacitor");
satelliteItem = new ItemOSBase("satellites",1,
"classic_mki","classic_mkii","classic_mkiii");
}
}

View File

@ -1,201 +0,0 @@
package fr.jackcartersmith.orbsat;
import java.util.Collection;
import java.util.HashMap;
import java.util.Set;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import fr.jackcartersmith.orbsat.OSEnums.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;
public class OSProperties {
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 OSEnums.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 final ImmutableSet<Boolean> allowedValues = ImmutableSet.of(Boolean.valueOf(false), Boolean.valueOf(true));
protected PropertyBoolInverted(String name)
{
super(name, Boolean.class);
}
@Override
public Collection<Boolean> getAllowedValues()
{
return this.allowedValues;
}
@Override
public Optional<Boolean> parseValue(String value)
{
return Optional.of(Boolean.getBoolean(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,30 +0,0 @@
package fr.jackcartersmith.orbsat;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
public class OSRefs {
public static final String MODID = "orbsat";
public static final String NAME = "Orbital Satellite";
public static final String VERSION = "0.1";
public static final String CLIENT_PROXY_CLASS = "fr.jackcartersmith.orbsat.client.ClientProxy";
public static final String COMMON_PROXY_CLASS = "fr.jackcartersmith.orbsat.common.CommonProxy";
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 ArrayList<Item> registeredOSItems = new ArrayList<Item>();
public static ArrayList<Block> registeredOSBlocks = new ArrayList<Block>();
}

View File

@ -1,119 +0,0 @@
package fr.jackcartersmith.orbsat;
import fr.jackcartersmith.orbsat.common.CommonProxy;
import fr.jackcartersmith.orbsat.common.util.OSLogger;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
@Mod(modid=OSRefs.MODID, name=OSRefs.NAME, version=OSRefs.VERSION, dependencies = "required-after:Forge@[12.18.3.2185,)")
public class OrbitalSatellite {
@Mod.Instance(OSRefs.MODID)
public static OrbitalSatellite INSTANCE;
@SidedProxy(clientSide=OSRefs.CLIENT_PROXY_CLASS, serverSide=OSRefs.COMMON_PROXY_CLASS)
public static CommonProxy proxy;
public static final SimpleNetworkWrapper packetHandler = NetworkRegistry.INSTANCE.newSimpleChannel(OSRefs.MODID);
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
OSLogger.info("[OrbSAT] Connection of primary laser chamber...");
OSItems.init();
OSBlocks.init();
proxy.preInit();
}
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
OSLogger.info("[OrbSAT] Sending satellite in orbit...");
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
OSLogger.info("[OrbSAT] Charging satellite for first laser strike...");
}
/*
* It's a begin for support 1.10 and 1.11 simultaly
*
*
@Mod.EventHandler
public void onMissingMapping(FMLMissingMappingsEvent event) {
OSLogger.warn("[OrbSAT] Repairing missing mappings...");
for (FMLMissingMappingsEvent.MissingMapping mapping : event.get()) {
String resourcePath = mapping.resourceLocation.getResourcePath().toLowerCase();
if (mapping.type == GameRegistry.Type.BLOCK) {
if ("newblockname".equals(resourcePath)) {
mapping.remap(OSBlocks.myNewBlock);
}
} else if (mapping.type == GameRegistry.Type.ITEM) {
if ("newitemname".equals(resourcePath)) {
mapping.remap(OSItems.myNewItem);
} else if ("newblockname".equals(resourcePath)) {
mapping.remap(Item.getItemFromBlock(OSBlocks.myNewBlock));
}
}
}
}
*/
public static <T extends IForgeRegistryEntry<?>> T register(T object, String name)
{
return registerByFullName(object, OSRefs.MODID+":"+name);
}
public static <T extends IForgeRegistryEntry<?>> T registerByFullName(T object, String name)
{
object.setRegistryName(new ResourceLocation(name));
OSLogger.debug("[OrbSAT] Register item "+object.getRegistryName());
return GameRegistry.register(object);
}
public static Block registerBlockByFullName(Block block, ItemBlock itemBlock, String name)
{
block = registerByFullName(block, name);
registerByFullName(itemBlock, name);
return block;
}
public static Block registerBlockByFullName(Block block, Class<? extends ItemBlock> itemBlock, String name)
{
try{
return registerBlockByFullName(block, itemBlock.getConstructor(Block.class).newInstance(block), name);
}catch(Exception e){e.printStackTrace();}
return null;
}
public static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlock, String name)
{
try{
return registerBlockByFullName(block, itemBlock.getConstructor(Block.class).newInstance(block), OSRefs.MODID+":"+name);
}catch(Exception e){e.printStackTrace();}
return null;
}
public static CreativeTabs creativeTab = new CreativeTabs(OSRefs.MODID)
{
@Override
public Item getTabIconItem()
{
return null;
}
@Override
public ItemStack getIconItemStack()
{
return new ItemStack(OSItems.componentsItem,1,1);
}
};
}

View File

@ -1,536 +0,0 @@
package fr.jackcartersmith.orbsat.block;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Sets;
import fr.jackcartersmith.orbsat.OSRefs;
import fr.jackcartersmith.orbsat.OrbitalSatellite;
import fr.jackcartersmith.orbsat.block.OSBlockInterface.IOSMetaBlock;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
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.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockOSBase<E extends Enum<E> & BlockOSBase.IBlockEnum> extends Block implements IOSMetaBlock{
protected static IProperty[] tempProperties;
protected static IUnlistedProperty[] tempUnlistedProperties;
public final String name;
public final PropertyEnum<E> property;
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, Integer> metaResistances = new HashMap<>();
protected boolean[] metaNotNormalBlock;
private boolean opaqueCube = false;
public BlockOSBase(String name, Material material, PropertyEnum<E> mainProperty, Class<? extends ItemBlockOSBase> 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];
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.setUnlocalizedName(registryName.replace(':', '.'));
this.setCreativeTab(OrbitalSatellite.creativeTab);
this.adjustSound();
OrbitalSatellite.registerBlockByFullName(this, itemBlock, registryName);
OSRefs.registeredOSBlocks.add(this);
lightOpacity = 255;
}
@Override
public String getOSBlockName()
{
return this.name;
}
@Override
public Enum[] getMetaEnums()
{
return enumValues;
}
@Override
public IBlockState getInventoryState(int meta)
{
IBlockState state = this.blockState.getBaseState().withProperty(this.property, enumValues[meta]);
// for(int i=0; i<this.additionalProperties.length; i++)
// if(this.additionalProperties[i]!=null && !this.additionalProperties[i].getAllowedValues().isEmpty())
// state = state.withProperty(this.additionalProperties[i], this.additionalProperties[i].getAllowedValues().toArray()[0]);
return state;
}
@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 getUnlocalizedName(ItemStack stack)
{
String subName = getStateFromMeta(stack.getItemDamage()).getValue(property).toString().toLowerCase(Locale.US);
return super.getUnlocalizedName() + "." + subName;
}
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 static Object[] combineProperties(Object[] currentProperties, Object... addedProperties)
{
Object[] array = new Object[currentProperties.length + addedProperties.length];
for(int i=0; i<currentProperties.length; i++)
array[i] = currentProperties[i];
for(int i=0; i<addedProperties.length; i++)
array[currentProperties.length+i] = addedProperties[i];
return array;
}
public BlockOSBase setMetaHidden(int... meta)
{
for(int i : meta)
if(i>=0 && i<this.isMetaHidden.length)
this.isMetaHidden[i] = true;
return this;
}
public BlockOSBase setMetaUnhidden(int... meta)
{
for(int i : meta)
if(i>=0 && i<this.isMetaHidden.length)
this.isMetaHidden[i] = false;
return this;
}
public boolean isMetaHidden(int meta)
{
return this.isMetaHidden[Math.max(0, Math.min(meta, this.isMetaHidden.length-1))];
}
public BlockOSBase setHasFlavour(int... meta)
{
if(meta==null||meta.length<1)
for(int i=0; i<hasFlavour.length; i++)
this.hasFlavour[i] = true;
else
for(int i : meta)
if(i>=0 && i<this.hasFlavour.length)
this.hasFlavour[i] = false;
return this;
}
public boolean hasFlavour(ItemStack stack)
{
return this.hasFlavour[Math.max(0, Math.min(stack.getItemDamage(), this.hasFlavour.length-1))];
}
public BlockOSBase<E> setBlockLayer(BlockRenderLayer... layer)
{
this.renderLayers = Sets.newHashSet(layer);
return this;
}
public BlockOSBase<E> setMetaBlockLayer(int meta, BlockRenderLayer... layer)
{
this.metaRenderLayers[Math.max(0, Math.min(meta, this.metaRenderLayers.length-1))] = Sets.newHashSet(layer);
return this;
}
@Override
public boolean canRenderInLayer(BlockRenderLayer layer)
{
if(cachedTileRequestState!=null)
{
int meta = this.getMetaFromState(cachedTileRequestState);
if(meta>=0 && meta<metaRenderLayers.length && metaRenderLayers[meta]!=null)
return metaRenderLayers[meta].contains(layer);
}
return renderLayers.contains(layer);
}
public BlockOSBase<E> setMetaLightOpacity(int meta, int opacity)
{
metaLightOpacities.put(meta, opacity);
return this;
}
@Override
public int getLightOpacity(IBlockState state, IBlockAccess w, BlockPos pos)
{
int meta = getMetaFromState(state);
if(metaLightOpacities.containsKey(meta))
return metaLightOpacities.get(meta);
return super.getLightOpacity(state,w,pos);
}
public BlockOSBase<E> setMetaExplosionResistance(int meta, int resistance)
{
metaResistances.put(meta, resistance);
return this;
}
@Override
public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion)
{
int meta = getMetaFromState(world.getBlockState(pos));
if(metaResistances.containsKey(meta))
return metaResistances.get(meta);
return super.getExplosionResistance(world, pos, exploder, explosion);
}
public BlockOSBase<E> setNotNormalBlock(int meta)
{
if(metaNotNormalBlock == null)
metaNotNormalBlock = new boolean[this.enumValues.length];
metaNotNormalBlock[meta] = true;
return this;
}
public BlockOSBase<E> setAllNotNormalBlock()
{
if(metaNotNormalBlock == null)
metaNotNormalBlock = new boolean[this.enumValues.length];
for(int i = 0; i < metaNotNormalBlock.length; i++)
metaNotNormalBlock[i] = true;
return this;
}
protected boolean normalBlockCheck(IBlockState state)
{
if(metaNotNormalBlock == null)
return true;
int meta = getMetaFromState(state);
return (meta < 0 || meta >= metaNotNormalBlock.length) || !metaNotNormalBlock[meta];
}
@Override
public boolean isFullBlock(IBlockState state)
{
return normalBlockCheck(state);
}
@Override
public boolean isFullCube(IBlockState state)
{
return normalBlockCheck(state);
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return normalBlockCheck(state);
}
@Override
public boolean isVisuallyOpaque()
{
if(metaNotNormalBlock == null)
return true;
int majority = 0;
for(boolean b : metaNotNormalBlock)
if(b)
majority++;
return majority<metaNotNormalBlock.length/2;
}
@Override
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
{
return normalBlockCheck(state);
}
//This is a ridiculously hacky workaround, I would not recommend it to anyone.
protected static IBlockState cachedTileRequestState;
@Override
public boolean hasTileEntity(IBlockState state)
{
cachedTileRequestState = state;
return super.hasTileEntity(state);
}
protected BlockStateContainer createNotTempBlockState()
{
IProperty[] array = new IProperty[1+this.additionalProperties.length];
array[0] = this.property;
for(int i=0; i<this.additionalProperties.length; i++)
array[1+i] = this.additionalProperties[i];
if(this.additionalUnlistedProperties.length>0)
return new ExtendedBlockState(this, array, additionalUnlistedProperties);
return new BlockStateContainer(this, array);
}
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 onIEBlockPlacedBy(World world, BlockPos pos, IBlockState state, EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase placer, ItemStack stack)
{
}
public boolean canIEBlockBePlaced(World world, BlockPos pos, IBlockState newState, EnumFacing side, float hitX, float hitY, float hitZ, EntityPlayer player, ItemStack stack)
{
return true;
}
@Override
protected BlockStateContainer createBlockState()
{
if(this.property!=null)
return createNotTempBlockState();
if(tempUnlistedProperties.length>0)
return new ExtendedBlockState(this, tempProperties, tempUnlistedProperties);
return new BlockStateContainer(this, tempProperties);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
}
@Override
public int getMetaFromState(IBlockState state)
{
if(state==null || !this.equals(state.getBlock()))
return 0;
return state.getValue(this.property).getMeta();
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
for(int i=0; i<this.additionalProperties.length; i++)
if(this.additionalProperties[i]!=null && !this.additionalProperties[i].getAllowedValues().isEmpty())
state = applyProperty(state, this.additionalProperties[i], this.additionalProperties[i].getAllowedValues().toArray()[0]);
return state;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState state = this.getDefaultState().withProperty(this.property, fromMeta(meta));
for(int i=0; i<this.additionalProperties.length; i++)
if(this.additionalProperties[i]!=null && !this.additionalProperties[i].getAllowedValues().isEmpty())
state = applyProperty(state, this.additionalProperties[i], this.additionalProperties[i].getAllowedValues().toArray()[0]);
return state;
// return this.getDefaultState().withProperty(this.property, fromMeta(meta));
}
protected E fromMeta(int meta)
{
if(meta<0||meta>=enumValues.length)
meta = 0;
return enumValues[meta];
}
@Override
public int damageDropped(IBlockState state)
{
return getMetaFromState(state);
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list)
{
for(E type : this.enumValues)
if(type.listForCreative() && !this.isMetaHidden[type.getMeta()])
list.add(new ItemStack(this, 1, type.getMeta()));
}
void adjustSound()
{
if(this.blockMaterial==Material.ANVIL)
this.blockSoundType = SoundType.ANVIL;
else if(this.blockMaterial==Material.CARPET||this.blockMaterial==Material.CLOTH)
this.blockSoundType = SoundType.CLOTH;
else if(this.blockMaterial==Material.GLASS||this.blockMaterial==Material.ICE)
this.blockSoundType = SoundType.GLASS;
else if(this.blockMaterial==Material.GRASS||this.blockMaterial==Material.TNT||this.blockMaterial==Material.PLANTS||this.blockMaterial==Material.VINE)
this.blockSoundType = SoundType.PLANT;
else if(this.blockMaterial==Material.GROUND)
this.blockSoundType = SoundType.GROUND;
else if(this.blockMaterial==Material.IRON)
this.blockSoundType = SoundType.METAL;
else if(this.blockMaterial==Material.SAND)
this.blockSoundType = SoundType.SAND;
else if(this.blockMaterial==Material.SNOW)
this.blockSoundType = SoundType.SNOW;
else if(this.blockMaterial==Material.ROCK)
this.blockSoundType = SoundType.STONE;
else if(this.blockMaterial==Material.WOOD||this.blockMaterial==Material.CACTUS)
this.blockSoundType = SoundType.WOOD;
}
@Override
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
{
if (worldIn.isRemote&&eventID==255)
{
worldIn.notifyBlockUpdate(pos,state,state,3);
return true;
}
return super.eventReceived(state, worldIn, pos, eventID, eventParam);
}
public boolean allowHammerHarvest(IBlockState blockState)
{
return false;
}
public boolean allowWirecutterHarvest(IBlockState blockState)
{
return false;
}
public boolean isOpaqueCube()
{
return opaqueCube;
}
public BlockOSBase<E> setOpaque(boolean isOpaque)
{
opaqueCube = isOpaque;
fullBlock = isOpaque;
return this;
}
/*
@Override
public boolean isToolEffective(String type, IBlockState state)
{
if(allowHammerHarvest(state) && type.equals(Lib.TOOL_HAMMER))
return true;
if(allowWirecutterHarvest(state) && type.equals(Lib.TOOL_WIRECUTTER))
return true;
return super.isToolEffective(type, state);
}
*/
public String createRegistryName()
{
return OSRefs.MODID+":"+name;
}
public interface IBlockEnum extends IStringSerializable
{
int getMeta();
boolean listForCreative();
}
public abstract static class IELadderBlock<E extends Enum<E> & IBlockEnum> extends BlockOSBase<E>
{
public IELadderBlock(String name, Material material, PropertyEnum<E> mainProperty,
Class<? extends ItemBlockOSBase> itemBlock, Object... additionalProperties)
{
super(name, material, mainProperty, itemBlock, additionalProperties);
}
@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn);
if (entityIn instanceof EntityLivingBase&&!((EntityLivingBase) entityIn).isOnLadder()&&isLadder(state, worldIn, pos, (EntityLivingBase)entityIn))
{
float f5 = 0.15F;
if (entityIn.motionX < -f5)
entityIn.motionX = -f5;
if (entityIn.motionX > f5)
entityIn.motionX = f5;
if (entityIn.motionZ < -f5)
entityIn.motionZ = -f5;
if (entityIn.motionZ > f5)
entityIn.motionZ = f5;
entityIn.fallDistance = 0.0F;
if (entityIn.motionY < -0.15D)
entityIn.motionY = -0.15D;
if(entityIn.motionY<0 && entityIn instanceof EntityPlayer && entityIn.isSneaking())
{
entityIn.motionY=.05;
return;
}
if(entityIn.isCollidedHorizontally)
entityIn.motionY=.2;
}
}
}
}

View File

@ -1,27 +0,0 @@
package fr.jackcartersmith.orbsat.block;
import java.util.Locale;
import net.minecraft.util.IStringSerializable;
public enum BlockType_Devices implements IStringSerializable, BlockOSBase.IBlockEnum{
SATELLITE_LAUNCHER,
SATELLITE_CENTRALE,
SATELLITE_ASSEMBLER;
@Override
public String getName() {
return this.toString().toLowerCase(Locale.ENGLISH);
}
@Override
public int getMeta()
{
return ordinal();
}
@Override
public boolean listForCreative()
{
return ordinal()!=12;
}
}

View File

@ -1,143 +0,0 @@
package fr.jackcartersmith.orbsat.block;
import java.util.List;
import java.util.Locale;
import fr.jackcartersmith.orbsat.OSRefs;
import fr.jackcartersmith.orbsat.client.ClientProxy;
import fr.jackcartersmith.orbsat.common.util.ItemNBTHelper;
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.client.resources.I18n;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemBlockOSBase extends ItemBlock{
public ItemBlockOSBase(Block b)
{
super(b);
if(((BlockOSBase)b).enumValues.length>1)
setHasSubtypes(true);
}
@Override
public int getMetadata (int damageValue)
{
return damageValue;
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> itemList)
{
this.block.getSubBlocks(item, tab, itemList);
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
return ((BlockOSBase) this.block).getUnlocalizedName(stack);
}
/*
@Override
@SideOnly(Side.CLIENT)
public FontRenderer getFontRenderer(ItemStack stack)
{
return ClientProxy.itemFont;
}
*/
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advInfo)
{
if(((BlockOSBase)block).hasFlavour(stack))
{
String subName = ((BlockOSBase)this.block).getStateFromMeta(stack.getItemDamage()).getValue(((BlockOSBase)this.block).property).toString().toLowerCase(Locale.US);
String flavourKey = OSRefs.DESC_FLAVOUR+((BlockOSBase)this.block).name+"."+subName;
list.add(TextFormatting.GRAY.toString()+ I18n.format(flavourKey));
}
super.addInformation(stack, player, list, advInfo);
if(ItemNBTHelper.hasKey(stack, "energyStorage"))
list.add(I18n.format("desc.immersiveengineering.info.energyStored", ItemNBTHelper.getInt(stack, "energyStorage")));
if(ItemNBTHelper.hasKey(stack, "tank"))
{
FluidStack fs = FluidStack.loadFluidStackFromNBT(ItemNBTHelper.getTagCompound(stack, "tank"));
if(fs!=null)
list.add(fs.getLocalizedName()+": "+fs.amount+"mB");
}
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState)
{
if(!((BlockOSBase)this.block).canIEBlockBePlaced(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)
{
((BlockOSBase)this.block).onIEBlockPlacedBy(world, pos, newState, side, hitX,hitY,hitZ, player, stack);
}
return ret;
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
IBlockState iblockstate = world.getBlockState(pos);
Block block = iblockstate.getBlock();
if (!block.isReplaceable(world, pos))
pos = pos.offset(side);
if(stack.stackSize > 0 && player.canPlayerEdit(pos, side, stack) && canBlockBePlaced(world, pos, side, stack))
{
int i = this.getMetadata(stack.getMetadata());
IBlockState iblockstate1 = this.block.onBlockPlaced(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.stackSize;
}
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)
{
BlockOSBase blockIn = (BlockOSBase) 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.canReplace(w, pos, side, stack);
}
}

View File

@ -1,280 +0,0 @@
package fr.jackcartersmith.orbsat.block;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Nullable;
import fr.jackcartersmith.orbsat.OSEnums;
import fr.jackcartersmith.orbsat.OSProperties.PropertyBoolInverted;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
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.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 OSBlockInterface {
public interface IOSMetaBlock
{
String getOSBlockName();
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);
}
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
*/
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 = BlockPistonBase.getFacingFromEntity(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;
}
}
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
{
OSEnums.SideConfig getSideConfig(int side);
default boolean toggleSide(int side, EntityPlayer p)
{
toggleSide(side);
return true;
}
@Deprecated
default void toggleSide(int side)
{}
}
public interface ITileDrop
{
ItemStack getTileDrop(EntityPlayer player, IBlockState 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 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
{
boolean isDummy();
void placeDummies(BlockPos pos, IBlockState state, EnumFacing side, float hitX, float hitY, float hitZ);
void breakDummies(BlockPos pos, IBlockState state);
}
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();
TileEntity getGuiMaster();
default void onGuiOpened(EntityPlayer player, boolean clientside)
{
}
}
public interface IProcessTile
{
int[] getCurrentProcessesStep();
int[] getCurrentProcessesMax();
}
public interface INeighbourChangeTile
{
void onNeighborBlockChange(BlockPos pos);
}
public interface IPropertyPassthrough
{
}
}

View File

@ -1,114 +0,0 @@
package fr.jackcartersmith.orbsat.client;
import java.util.Locale;
import fr.jackcartersmith.orbsat.OSRefs;
import fr.jackcartersmith.orbsat.block.OSBlockInterface.IOSMetaBlock;
import fr.jackcartersmith.orbsat.common.CommonProxy;
import fr.jackcartersmith.orbsat.item.ItemOSBase;
import fr.jackcartersmith.orbsat.models.obj.OSOBJLoader;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.fml.common.registry.GameData;
public class ClientProxy extends CommonProxy{
@Override
public void preInit(){
Minecraft.getMinecraft().getFramebuffer().enableStencil();//Enabling FBO stencils
ModelLoaderRegistry.registerLoader(OSOBJLoader.instance);
OBJLoader.INSTANCE.addDomain(OSRefs.MODID);
OSOBJLoader.instance.addDomain(OSRefs.MODID);
for(Block block : OSRefs.registeredOSBlocks)
{
Item blockItem = Item.getItemFromBlock(block);
final ResourceLocation loc = GameData.getBlockRegistry().getNameForObject(block);
if(block instanceof IOSMetaBlock)
{
IOSMetaBlock ieMetaBlock = (IOSMetaBlock) block;
if(ieMetaBlock.useCustomStateMapper())
ModelLoader.setCustomStateMapper(block, OSCustomStateMapper.getStateMapper(ieMetaBlock));
ModelLoader.setCustomMeshDefinition(blockItem, new ItemMeshDefinition()
{
@Override
public ModelResourceLocation getModelLocation(ItemStack stack)
{
return new ModelResourceLocation(loc, "inventory");
}
});
for(int meta = 0; meta < ieMetaBlock.getMetaEnums().length; meta++)
{
String location = loc.toString();
String prop = ieMetaBlock.appendPropertiesToState() ? ("inventory," + ieMetaBlock.getMetaProperty().getName() + "=" + ieMetaBlock.getMetaEnums()[meta].toString().toLowerCase(Locale.US)) : null;
if(ieMetaBlock.useCustomStateMapper())
{
String custom = ieMetaBlock.getCustomStateMapping(meta, true);
if(custom != null)
location += "_" + custom;
}
try
{
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
} catch(NullPointerException npe)
{
throw new RuntimeException("WELP! apparently " + ieMetaBlock + " lacks an item!", npe);
}
}
} else
ModelLoader.setCustomModelResourceLocation(blockItem, 0, new ModelResourceLocation(loc, "inventory"));
}
for(Item item : OSRefs.registeredOSItems)
{
if(item instanceof Item)
{
ItemOSBase ieMetaItem = (ItemOSBase) item;
if(ieMetaItem.registerSubModels && ieMetaItem.getSubNames() != null && ieMetaItem.getSubNames().length > 0)
{
for(int meta = 0; meta < ieMetaItem.getSubNames().length; meta++)
{
ResourceLocation loc = new ResourceLocation("orbsat", ieMetaItem.itemName + "/" + ieMetaItem.getSubNames()[meta]);
ModelBakery.registerItemVariants(ieMetaItem, loc);
ModelLoader.setCustomModelResourceLocation(ieMetaItem, meta, new ModelResourceLocation(loc, "inventory"));
}
} else
{
final ResourceLocation loc = new ResourceLocation("orbsat", ieMetaItem.itemName);
ModelBakery.registerItemVariants(ieMetaItem, loc);
ModelLoader.setCustomMeshDefinition(ieMetaItem, new ItemMeshDefinition()
{
@Override
public ModelResourceLocation getModelLocation(ItemStack stack)
{
return new ModelResourceLocation(loc, "inventory");
}
});
}
}
else
{
final ResourceLocation loc = GameData.getItemRegistry().getNameForObject(item);
ModelBakery.registerItemVariants(item, loc);
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition()
{
@Override
public ModelResourceLocation getModelLocation(ItemStack stack)
{
return new ModelResourceLocation(loc, "inventory");
}
});
}
}
}
}

View File

@ -1,46 +0,0 @@
package fr.jackcartersmith.orbsat.client;
import java.util.HashMap;
import fr.jackcartersmith.orbsat.block.OSBlockInterface.IOSMetaBlock;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.util.ResourceLocation;
public class OSCustomStateMapper extends StateMapperBase{
public static HashMap<String, StateMapperBase> stateMappers = new HashMap<>();
public static StateMapperBase getStateMapper(IOSMetaBlock metaBlock)
{
String key = metaBlock.getOSBlockName();
StateMapperBase mapper = stateMappers.get(key);
if(mapper==null)
{
mapper = metaBlock.getCustomMapper();
if(mapper==null)
mapper = new OSCustomStateMapper();
stateMappers.put(key, mapper);
}
return mapper;
}
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
try{
ResourceLocation rl = Block.REGISTRY.getNameForObject(state.getBlock());
IOSMetaBlock metaBlock = (IOSMetaBlock)state.getBlock();
String custom = metaBlock.getCustomStateMapping(state.getBlock().getMetaFromState(state), false);
if(custom!=null)
rl = new ResourceLocation(rl.toString()+"_"+custom);
String prop = metaBlock.appendPropertiesToState()?this.getPropertyString(state.getProperties()):null;
return new ModelResourceLocation(rl, prop);
}catch(Exception e)
{
e.printStackTrace();
ResourceLocation rl = Block.REGISTRY.getNameForObject(state.getBlock());
return new ModelResourceLocation(rl, this.getPropertyString(state.getProperties()));
}
}
}

View File

@ -1,11 +0,0 @@
package fr.jackcartersmith.orbsat.common;
public class CommonProxy{
public void registerRender(){
}
public void preInit() {}
}

View File

@ -1,369 +0,0 @@
package fr.jackcartersmith.orbsat.common;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Field;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import fr.jackcartersmith.orbsat.OSRefs;
import fr.jackcartersmith.orbsat.common.Config.OSConfig.Machines;
import fr.jackcartersmith.orbsat.common.util.OSLogger;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Config.Comment;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
public class Config {
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[]>();
public static boolean seaonal_festive = false;
@net.minecraftforge.common.config.Config(modid=OSRefs.MODID)
public static class OSConfig
{
//Wire Stuff
@Comment({"Drop connections with non-existing endpoints when loading the world. Use with care and backups and only when suspecting corrupted data.", "This option will check and load all connection endpoints and may slow down the world loading process."})
public static boolean validateConnections = false;
@Comment({"The transfer rates in Flux/t for the wire tiers (copper, electrum, HV, Structural Rope, Cable & Redstone(no transfer) )"})
@Mapped(mapClass = Config.class, mapName = "manual_intA")
public static int[] wireTransferRate = new int[]{2048, 8192, 32768, 0, 0, 0};
@Comment({"The percentage of power lost every 16 blocks of distance for the wire tiers (copper, electrum, HV, Structural Rope, Cable & Redstone(no transfer) )"})
public static double[] wireLossRatio = new double[]{.05, .025, .025, 1, 1, 1};
@Comment({"The RGB colourate of the wires."})
public static int[] wireColouration = new int[]{0xb36c3f, 0xeda045, 0x6f6f6f, 0x967e6d, 0x6f6f6f, 0xff2f2f};
@Comment({"The maximum length wire can have. Copper and Electrum should be similar, Steel is meant for long range transport, Structural Rope & Cables are purely decorational"})
public static int[] wireLength = new int[]{16, 16, 32, 32, 32, 32};
@Comment({"By default all devices that accept cables have increased renderbounds to show cables even if the block itself is not in view.", "Disabling this reduces them to their minimum sizes, which might improve FPS on low-power PCs"})
//TODO this is for TESR wires. Remove?
public static boolean increasedRenderboxes = true;
@Comment({"Disables most lighting code for certain models that are rendered dynamically (TESR). May improve FPS.", "Affects turrets and garden cloches"})
public static boolean disableFancyTESR = false;
@Comment({"Support for colourblind people, gives a text-based output on capacitor sides"})
public static boolean colourblindSupport = false;
@Comment({"Set this to false to disable the super awesome looking nixie tube front for the voltmeter and other things"})
public static boolean nixietubeFont = true;
@Comment({"Set this to false to disable the manual's forced change of GUI scale"})
public static boolean adjustManualScale = false;
@Comment({"Set this to true if you suffer from bad eyesight. The Engineer's manual will be switched to a bold and darker text to improve readability.", "Note that this may lead to a break of formatting and have text go off the page in some instances. This is unavoidable."})
public static boolean badEyesight = false;
@Comment({"Controls if item tooltips should contain the OreDictionary names of items. These tooltips are only visible in advanced tooltip mod (F3+H)"})
public static boolean oreTooltips = 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;
@Comment({"A list of preferred Mod IDs that results of IE processes should stem from, aka which mod you want the copper to come from.", "This affects the ores dug by the excavator, as well as those crushing recipes that don't have associated IE items. This list is in oreder of priority."})
public static String[] preferredOres = new String[]{OSRefs.MODID};
@Comment({"Set this to false to hide the update news in the manual"})
public static boolean showUpdateNews = true;
@Comment({"Set this to false to stop the IE villager house from spawning"})
public static boolean villagerHouse = true;
@Comment({"Set this to false to remove IE villagers from the game"})
public static boolean enableVillagers = true;
@Comment({"The weight that hempseeds have when breaking tall grass. 5 by default, set to 0 to disable drops"})
public static int hempSeedWeight = 5;
public static Machines machines = new Machines();
public static Ores ores = new Ores();
public static Tools tools = new Tools();
public static class Machines
{
//Connectors
@Comment({"In- and output rates of LV,MV and HV Wire Conenctors. This is independant of the transferrate of the wires."})
@Mapped(mapClass = Config.class, mapName = "manual_intA")
public static int[] wireConnectorInput = new int[]{256, 1024, 4096};
//Capacitors
@Comment({"The maximum amount of Flux that can be stored in a low-voltage capacitor"})
public static int capacitorLV_storage = 100000;
@Comment({"The maximum amount of Flux that can be input into a low-voltage capacitor (by IE net or other means)"})
public static int capacitorLV_input = 256;
@Comment({"The maximum amount of Flux that can be output from a low-voltage capacitor (by IE net or other means)"})
public static int capacitorLV_output = 256;
@Comment({"The maximum amount of Flux that can be stored in a medium-voltage capacitor"})
public static int capacitorMV_storage = 1000000;
@Comment({"The maximum amount of Flux that can be input into a medium-voltage capacitor (by IE net or other means)"})
public static int capacitorMV_input = 1024;
@Comment({"The maximum amount of Flux that can be output from a medium-voltage capacitor (by IE net or other means)"})
public static int capacitorMV_output = 1024;
@Comment({"The maximum amount of Flux that can be stored in a high-voltage capacitor"})
public static int capacitorHV_storage = 4000000;
@Comment({"The maximum amount of Flux that can be input into a high-voltage capacitor (by IE net or other means)"})
public static int capacitorHV_input = 4096;
@Comment({"The maximum amount of Flux that can be output from a high-voltage capacitor (by IE net or other means)"})
public static int capacitorHV_output = 4096;
//Generators
@Comment({"The base Flux that is output by the dynamo. This will be modified by the rotation modifier of the attached water- or windmill"})
public static double dynamo_output = 3d;
@Comment({"Output modifier for the energy created by the Thermoelectric Generator"})
public static double thermoelectric_output = 1d;
@Comment({"The Flux that will be output by the lightning rod when it is struck"})
public static int lightning_output = 4 * 4000000;
@Comment({"The Flux per tick that the Diesel Generator will output. The burn time of the fuel determines the total output"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int dieselGen_output = 4096;
//Simple Machines
@Comment({"The Flux per tick consumed to add one heat to a furnace. Creates up to 4 heat in the startup time and then 1 heat per tick to keep it running"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int heater_consumption = 8;
@Comment({"The Flux per tick consumed to double the speed of the furnace. Only happens if furnace is at maximum heat."})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int heater_speedupConsumption = 24;
@Comment({"The Flux per tick the Blast Furnace Preheater will consume to speed up the Blast Furnace"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int preheater_consumption = 32;
@Comment({"The length in ticks it takes for the Core Sample Drill to figure out which mineral is found in a chunk"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int coredrill_time = 200;
@Comment({"The Flux per tick consumed by the Core Sample Drill"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int coredrill_consumption = 40;
@Comment({"The Flux the Fluid Pump will consume to pick up a fluid block in the world"})
public static int pump_consumption = 250;
@Comment({"The Flux the Fluid Pump will consume pressurize+accellerate fluids, increasing the transferrate"})
public static int pump_consumption_accelerate = 5;
@Comment({"Set this to false to disable the fluid pump being able to draw infinite water from sources"})
@Mapped(mapClass = Config.class, mapName = "manual_bool")
public static boolean pump_infiniteWater = true;
@Comment({"If this is set to true (default) the pump will replace fluids it picks up with cobblestone in order to reduce lag caused by flowing fluids."})
@Mapped(mapClass = Config.class, mapName = "manual_bool")
public static boolean pump_placeCobble = true;
@Comment({"The Flux per tick the Charging Station can insert into an item"})
public static int charger_consumption = 256;
@Comment({"The Flux per tick the Tesla Coil will consume, simply by being active"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int teslacoil_consumption = 256;
@Comment({"The amount of Flux the Tesla Coil will consume when shocking an entity"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int teslacoil_consumption_active = 512;
@Comment({"The amount of damage the Tesla Coil will do when shocking an entity"})
public static float teslacoil_damage = 6;
@Comment({"The Flux per tick any turret consumes to monitor the area"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int turret_consumption = 64;
@Comment({"The Flux per tick the chemthrower turret consumes to shoot"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int turret_chem_consumption = 32;
@Comment({"The Flux per tick the gun turret consumes to shoot"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int turret_gun_consumption = 32;
@Comment({"The Flux per tick the belljar consumes to grow plants"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int belljar_consumption = 8;
@Comment({"The amount of ticks one dose of fertilizer lasts in the belljar"})
public static int belljar_fertilizer = 6000;
@Comment({"The amount of fluid the belljar uses per dose of fertilizer"})
public static int belljar_fluid = 250;
//Lights
@Comment({"Set this to false to disable the mob-spawn prevention of the Powered Lantern"})
public static boolean lantern_spawnPrevent = true;
@Comment({"How much Flux the powered lantern draws per tick"})
public static int lantern_energyDraw = 1;
@Comment({"How much Flux the powered lantern can hold (should be greater than the power draw)"})
public static int lantern_maximumStorage = 10;
@Comment({"Set this to false to disable the mob-spawn prevention of the Floodlight"})
public static boolean floodlight_spawnPrevent = true;
@Comment({"How much Flux the floodlight draws per tick"})
public static int floodlight_energyDraw = 5;
@Comment({"How much Flux the floodlight can hold (must be at least 10x the power draw)"})
public static int floodlight_maximumStorage = 80;
//Multiblock Recipes
@Comment({"A modifier to apply to the energy costs of every MetalPress recipe"})
public static float metalPress_energyModifier = 1;
@Comment({"A modifier to apply to the time of every MetalPress recipe"})
public static float metalPress_timeModifier = 1;
@Comment({"A modifier to apply to the energy costs of every Crusher recipe"})
public static float crusher_energyModifier = 1;
@Comment({"A modifier to apply to the time of every Crusher recipe"})
public static float crusher_timeModifier = 1;
@Comment({"A modifier to apply to the energy costs of every Squeezer recipe"})
public static float squeezer_energyModifier = 1;
@Comment({"A modifier to apply to the time of every Squeezer recipe"})
public static float squeezer_timeModifier = 1;
@Comment({"A modifier to apply to the energy costs of every Fermenter recipe"})
public static float fermenter_energyModifier = 1;
@Comment({"A modifier to apply to the time of every Fermenter recipe"})
public static float fermenter_timeModifier = 1;
@Comment({"A modifier to apply to the energy costs of every Refinery recipe"})
public static float refinery_energyModifier = 1;
@Comment({"A modifier to apply to the time of every Refinery recipe. Can't be lower than 1"})
public static float refinery_timeModifier = 1;
@Comment({"A modifier to apply to the energy costs of every Arc Furnace recipe"})
public static float arcFurnace_energyModifier = 1;
@Comment({"A modifier to apply to the time of every Arc Furnace recipe"})
public static float arcFurnace_timeModifier = 1;
@Comment({"The maximum amount of damage Graphite Electrodes can take. While the furnace is working, electrodes sustain 1 damage per tick, so this is effectively the lifetime in ticks. The default value of 96000 makes them last for 8 consecutive ingame days"})
public static int arcfurnace_electrodeDamage = 96000;
@Comment({"Set this to true to make the blueprint for graphite electrodes craftable in addition to villager/dungeon loot"})
@Mapped(mapClass = Config.class, mapName = "manual_bool")
public static boolean arcfurnace_electrodeCrafting = false;
@Comment({"Set this to false to disable the Arc Furnace's recycling of armors and tools"})
public static boolean arcfurnace_recycle = true;
@Comment({"A modifier to apply to the energy costs of every Automatic Workbench recipe"})
public static float autoWorkbench_energyModifier = 1;
@Comment({"A modifier to apply to the time of every Automatic Workbench recipe"})
public static float autoWorkbench_timeModifier = 1;
@Comment({"A modifier to apply to the energy costs of every Bottling Machine's process"})
public static float bottlingMachine_energyModifier = 1;
@Comment({"A modifier to apply to the time of every Bottling Machine's process"})
public static float bottlingMachine_timeModifier = 1;
@Comment({"A modifier to apply to the energy costs of every Mixer's process"})
public static float mixer_energyModifier = 1;
@Comment({"A modifier to apply to the time of every Mixer's process"})
public static float mixer_timeModifier = 1;
//Other Multiblock machines
@Comment({"The Flux the Assembler will consume to craft an item from a recipe"})
public static int assembler_consumption = 80;
//@Comment({"The Flux the Bottling Machine will consume per tick, when filling items"})
//public static int bottlingMachine_consumption = 8;
@Comment({"The Flux per tick the Excavator will consume to dig"})
@Mapped(mapClass = Config.class, mapName = "manual_int")
public static int excavator_consumption = 4096;
@Comment({"The speed of the Excavator. Basically translates to how many degrees per tick it will turn."})
public static double excavator_speed = 1d;
@Comment({"Set this to false to disable the ridiculous amounts of particles the Excavator spawns"})
public static boolean excavator_particles = true;
@Comment({"The chance that a given chunk will contain a mineral vein."})
public static double excavator_chance = .2d;
@Comment({"The chance that the Excavator will not dig up an ore with the currently downward-facing bucket."})
public static double excavator_fail_chance = .05d;
@Comment({"The maximum amount of yield one can get out of a chunk with the excavator. Set a number smaller than zero to make it infinite"})
public static int excavator_depletion = 38400;
@Comment({"List of dimensions that can't contain minerals. Default: The End."})
public static int[] excavator_dimBlacklist = new int[]{1};
}
public static class Ores
{
@Comment({"Generation config for Copper Ore.", "Parameters: Vein size, lowest possible Y, highest possible Y, veins per chunk, chance for vein to spawn (out of 100). Set vein size to 0 to disable the generation"})
@Mapped(mapClass = Config.class, mapName = "manual_intA")
public static int[] ore_copper = new int[]{8, 40, 72, 8, 100};
@Comment({"Generation config for Bauxite Ore.", "Parameters: Vein size, lowest possible Y, highest possible Y, veins per chunk, chance for vein to spawn (out of 100). Set vein size to 0 to disable the generation"})
@Mapped(mapClass = Config.class, mapName = "manual_intA")
public static int[] ore_bauxite = new int[]{4, 40, 85, 8, 100};
@Comment({"Generation config for Lead Ore.", "Parameters: Vein size, lowest possible Y, highest possible Y, veins per chunk, chance for vein to spawn (out of 100). Set vein size to 0 to disable the generation"})
@Mapped(mapClass = Config.class, mapName = "manual_intA")
public static int[] ore_lead = new int[]{6, 8, 36, 4, 100};
@Comment({"Generation config for Silver Ore.", "Parameters: Vein size, lowest possible Y, highest possible Y, veins per chunk, chance for vein to spawn (out of 100). Set vein size to 0 to disable the generation"})
@Mapped(mapClass = Config.class, mapName = "manual_intA")
public static int[] ore_silver = new int[]{8, 8, 40, 4, 80};
@Comment({"Generation config for Nickel Ore.", "Parameters: Vein size, lowest possible Y, highest possible Y, veins per chunk, chance for vein to spawn (out of 100). Set vein size to 0 to disable the generation"})
@Mapped(mapClass = Config.class, mapName = "manual_intA")
public static int[] ore_nickel = new int[]{6, 8, 24, 2, 100};
@Comment({"Generation config for Uranium Ore.", "Parameters: Vein size, lowest possible Y, highest possible Y, veins per chunk, chance for vein to spawn (out of 100). Set vein size to 0 to disable the generation"})
@Mapped(mapClass = Config.class, mapName = "manual_intA")
public static int[] ore_uranium = new int[]{4, 8, 24, 2, 60};
@Comment({"A blacklist of dimensions in which IE ores won't spawn. By default this is Nether (-1) and End (1)"})
public static int[] oreDimBlacklist = new int[]{-1, 1};
@Comment({"Set this to false to disable the logging of the chunks that were flagged for retrogen."})
public static boolean retrogen_log_flagChunk = true;
@Comment({"Set this to false to disable the logging of the chunks that are still left to retrogen."})
public static boolean retrogen_log_remaining = true;
}
public static class Tools
{
@Comment({"Set this to true to completely disable the ore-crushing recipes with the Engineers Hammer"})
public static boolean disableHammerCrushing = false;
@Comment({"The maximum durability of the Engineer's Hammer. Used up when hammering ingots into plates."})
public static int hammerDurabiliy = 100;
@Comment({"The maximum durability of the Wirecutter. Used up when cutting plates into wire."})
public static int cutterDurabiliy = 250;
//@Comment({"Enable this to use the old, harder bullet recipes(require one ingot per bullet)"});
//public static boolean hardmodeBulletRecipes = false;
@Comment({"The amount of base damage a Casull Cartridge inflicts"})
public static float bulletDamage_Casull = 10f;
@Comment({"The amount of base damage an ArmorPiercing Cartridge inflicts"})
public static float bulletDamage_AP = 10f;
@Comment({"The amount of base damage a single part of Buckshot inflicts"})
public static float bulletDamage_Buck = 2f;
@Comment({"The amount of base damage a DragonsBreath Cartridge inflicts"})
public static float bulletDamage_Dragon = 3f;
@Comment({"The amount of base damage a Homing Cartridge inflicts"})
public static float bulletDamage_Homing = 10f;
@Comment({"The amount of base damage a Wolfpack Cartridge inflicts"})
public static float bulletDamage_Wolfpack = 6f;
@Comment({"The amount of damage the sub-projectiles of the Wolfpack Cartridge inflict"})
public static float bulletDamage_WolfpackPart = 4f;
@Comment({"The amount of damage a silver bullet inflicts"})
public static float bulletDamage_Silver = 10f;
@Comment({"The amount of base damage a Phial Cartridge inflicts"})
public static float bulletDamage_Potion = 1f;
@Comment({"A list of sounds that should not be muffled by the Ear Defenders. Adding to this list requires knowledge of the correct sound resource names."})
public static String[] earDefenders_SoundBlacklist = new String[]{};
@Comment({"The mb of fluid the Chemical Thrower will consume per tick of usage"})
public static int chemthrower_consumption = 10;
@Comment({"The base amount of Flux consumed per shot by the Railgun"})
public static int railgun_consumption = 800;
@Comment({"A modifier for the damage of all projectiles fired by the Railgun"})
public static float railgun_damage = 1f;
}
}
static Configuration config;
public static void preInit(FMLPreInitializationEvent event)
{
if(OSConfig.validateConnections)
OSLogger.warn("Connection validation enabled");
Calendar calendar = Calendar.getInstance();
seaonal_festive = calendar.get(Calendar.MONTH)+1==12;//December
Config.manual_int.put("excavator_depletion_days", Machines.excavator_depletion*45/24000);
Config.manual_bool.put("literalRailGun", false);//preventive measure for Railcraft
checkMappedValues(OSConfig.class);
}
public static void checkMappedValues(Class confClass)
{
for(Field f : confClass.getDeclaredFields())
{
Mapped mapped = f.getAnnotation(Mapped.class);
if(mapped!=null)
try
{
Class c = mapped.mapClass();
if(c!=null)
{
Field mapField = c.getDeclaredField(mapped.mapName());
if(mapField!=null)
{
Map map = (Map)mapField.get(null);
if(map!=null)
map.put(f.getName(),f.get(null));
}
}
}catch(Exception e){
e.printStackTrace();
}
else if(f.getType().getSuperclass()==Object.class) //Only support classes that are one level below Object.
{
checkMappedValues(f.getType());
}
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Mapped
{
Class mapClass();
String mapName();
}
}

View File

@ -1,16 +0,0 @@
package fr.jackcartersmith.orbsat.common;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
public class OSContents {
public static ArrayList<Block> registeredIPBlocks = new ArrayList<Block>();
public static ArrayList<Item> registeredIPItems = new ArrayList<Item>();
public static void preInit(){
}
}

View File

@ -1,109 +0,0 @@
package fr.jackcartersmith.orbsat.common.util;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
public class ComparableItemStack {
public ItemStack stack;
public boolean useNBT;
public int oreID=-1;
public ComparableItemStack(ItemStack stack)
{
this(stack, true);
}
public ComparableItemStack(ItemStack stack, boolean matchOre)
{
if(stack==null)
throw new RuntimeException("You cannot instantiate a ComparableItemStack with null for an Item!");
this.stack = stack;
if(matchOre)
{
int[] oids = OreDictionary.getOreIDs(stack);
if(oids!=null&&oids.length > 0)
this.oreID = oids[0];
}
}
public ComparableItemStack(String oreName)
{
//this(IEApi.getPreferredOreStack(oreName));
this.oreID = OreDictionary.getOreID(oreName);
}
public ComparableItemStack setUseNBT(boolean useNBT)
{
this.useNBT = useNBT;
return this;
}
public ComparableItemStack setOreID(int oid)
{
this.oreID = oid;
return this;
}
@Override
public String toString()
{
return "ComparableStack: {"+this.stack.toString()+"}; oreID: "+this.oreID+"; checkNBT: "+this.useNBT;
}
@Override
public int hashCode()
{
if(this.oreID!=-1)
return this.oreID;
int hash = (stack.getItemDamage()&0xffff)*31 + stack.getItem().hashCode()*31;
if(this.useNBT && stack.hasTagCompound())
hash += stack.getTagCompound().hashCode()*31;
return hash;
}
@Override
public boolean equals(Object object)
{
if(!(object instanceof ComparableItemStack))
return false;
if(this.oreID!=-1 && ((ComparableItemStack)object).oreID!=-1)
return this.oreID == ((ComparableItemStack)object).oreID;
ItemStack otherStack = ((ComparableItemStack)object).stack;
if(!OreDictionary.itemMatches(stack,otherStack, false))
return false;
if(this.useNBT)
{
if(this.stack.hasTagCompound() != otherStack.hasTagCompound())
return false;
if(!this.stack.hasTagCompound() && !otherStack.hasTagCompound())
return true;
if(!this.stack.getTagCompound().equals(otherStack.getTagCompound()))
return false;
}
return true;
}
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
if(this.oreID!=-1)
nbt.setString("oreID", OreDictionary.getOreName(oreID));
else
{
nbt.setTag("stack", stack.writeToNBT(new NBTTagCompound()));
nbt.setBoolean("useNBT", useNBT);
}
return nbt;
}
public static ComparableItemStack readFromNBT(NBTTagCompound nbt)
{
if(nbt.hasKey("oreID"))
return new ComparableItemStack(nbt.getString("oreID"));
else if(nbt.hasKey("stack"))
{
ComparableItemStack comp = new ComparableItemStack(ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stack")));
comp.useNBT = nbt.getBoolean("useNBT");
return comp;
}
return null;
}
}

View File

@ -1,247 +0,0 @@
package fr.jackcartersmith.orbsat.common.util;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack;
public class ItemNBTHelper {
public static NBTTagCompound getTag(ItemStack stack)
{
if(!stack.hasTagCompound())
stack.setTagCompound(new NBTTagCompound());
return stack.getTagCompound();
}
public static boolean hasTag(ItemStack stack)
{
return stack.hasTagCompound();
}
public static boolean hasKey(ItemStack stack, String key)
{
return hasTag(stack) && getTag(stack).hasKey(key);
}
public static void remove(ItemStack stack, String key)
{
if(hasKey(stack, key))
{
getTag(stack).removeTag(key);
if(getTag(stack).hasNoTags())
stack.setTagCompound(null);
}
}
public static void setInt(ItemStack stack, String key, int val)
{
getTag(stack).setInteger(key, val);
}
public static void modifyInt(ItemStack stack, String key, int mod)
{
getTag(stack).setInteger(key, getTag(stack).getInteger(key)+mod);
}
public static int getInt(ItemStack stack, String key)
{
return hasTag(stack) ? getTag(stack).getInteger(key) : 0;
}
public static void setString(ItemStack stack, String key, String val)
{
getTag(stack).setString(key, val);
}
public static String getString(ItemStack stack, String key)
{
return hasTag(stack) ? getTag(stack).getString(key) : "";
}
public static void setLong(ItemStack stack, String key, long val)
{
getTag(stack).setLong(key, val);
}
public static long getLong(ItemStack stack, String key)
{
return hasTag(stack) ? getTag(stack).getLong(key) : 0;
}
public static void setIntArray(ItemStack stack, String key, int[] val)
{
getTag(stack).setIntArray(key, val);
}
public static int[] getIntArray(ItemStack stack, String key)
{
return hasTag(stack) ? getTag(stack).getIntArray(key) : new int[0];
}
public static void setFloat(ItemStack stack, String key, float val)
{
getTag(stack).setFloat(key, val);
}
public static float getFloat(ItemStack stack, String key)
{
return hasTag(stack) ? getTag(stack).getFloat(key) : 0;
}
public static void setBoolean(ItemStack stack, String key, boolean val)
{
getTag(stack).setBoolean(key, val);
}
public static boolean getBoolean(ItemStack stack, String key)
{
return hasTag(stack) && getTag(stack).getBoolean(key);
}
public static void setTagCompound(ItemStack stack, String key, NBTTagCompound val)
{
getTag(stack).setTag(key, val);
}
public static NBTTagCompound getTagCompound(ItemStack stack, String key)
{
return hasTag(stack) ? getTag(stack).getCompoundTag(key) : new NBTTagCompound();
}
public static void setDelayedSoundsForStack(ItemStack stack, String nbtKey, String sound, float volume, float pitch, int amount, int baseDelay, int iDelay)
{
int[] delayedSounds = new int[amount];
for(int i=0; i<delayedSounds.length; i++)
delayedSounds[i]=baseDelay+i*iDelay;
setIntArray(stack, "delayedSound_"+nbtKey+"_delay", delayedSounds);
setString(stack, "delayedSound_"+nbtKey+"_sound", sound);
setFloat(stack, "delayedSound_"+nbtKey+"_volume", volume);
setFloat(stack, "delayedSound_"+nbtKey+"_pitch", pitch);
}
public static int handleDelayedSoundsForStack(ItemStack stack, String nbtKey, Entity ent)
{
if(!hasKey(stack, "delayedSound_"+nbtKey+"_delay"))
return -1;
int[] delayedSounds = ItemNBTHelper.getIntArray(stack, "delayedSound_"+nbtKey+"_delay");
int l = 0;
for(int i=0; i<delayedSounds.length; i++)
{
--delayedSounds[i];
if(delayedSounds[i]<=0)
{
//ToDo: Delayed Sounds could be nicer anyway.
// ent.playSound();
// ent.worldObj.playSoundAtEntity(ent, getString(stack, "delayedSound_"+nbtKey+"_sound"), getFloat(stack, "delayedSound_"+nbtKey+"_volume"), getFloat(stack, "delayedSound_"+nbtKey+"_pitch"));
}
else
++l;
}
if(l>0)
{
ItemNBTHelper.setIntArray(stack, "delayedSound_"+nbtKey+"_delay", delayedSounds);
}
else
{
ItemNBTHelper.remove(stack, "delayedSound_"+nbtKey+"_delay");
ItemNBTHelper.remove(stack, "delayedSound_"+nbtKey+"_sound");
ItemNBTHelper.remove(stack, "delayedSound_"+nbtKey+"_volume");
ItemNBTHelper.remove(stack, "delayedSound_"+nbtKey+"_pitch");
}
return l;
}
public static void setFluidStack(ItemStack stack, String key, FluidStack val)
{
if(val!=null && val.getFluid()!=null)
{
NBTTagCompound tag = getTagCompound(stack, key);
setTagCompound(stack, FluidHandlerItemStack.FLUID_NBT_KEY, val.writeToNBT(new NBTTagCompound()));
}
else
remove(stack, FluidHandlerItemStack.FLUID_NBT_KEY);
}
public static FluidStack getFluidStack(ItemStack stack, String key)
{
if(hasTag(stack))
{
NBTTagCompound tag = getTagCompound(stack, key);
return FluidStack.loadFluidStackFromNBT(tag.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY));
}
return null;
}
public static void setItemStack(ItemStack stack, String key, ItemStack val)
{
getTag(stack).setTag(key, val.writeToNBT(new NBTTagCompound()));
}
public static ItemStack getItemStack(ItemStack stack, String key)
{
if(hasTag(stack) && getTag(stack).hasKey(key))
return ItemStack.loadItemStackFromNBT(getTagCompound(stack, key));
return null;
}
public static void setLore(ItemStack stack, String... lore)
{
NBTTagCompound displayTag = getTagCompound(stack, "display");
NBTTagList list = new NBTTagList();
for(String s : lore)
list.appendTag(new NBTTagString(s));
displayTag.setTag("Lore", list);
setTagCompound(stack, "display", displayTag);
}
public static int insertFluxItem(ItemStack container, int energy, int maxEnergy, boolean simulate)
{
int stored = getFluxStoredInItem(container);
int accepted = Math.min(energy, maxEnergy-stored);
if(!simulate)
{
stored += accepted;
ItemNBTHelper.setInt(container, "energy", stored);
}
return accepted;
}
public static int extractFluxFromItem(ItemStack container, int energy, boolean simulate)
{
int stored = getFluxStoredInItem(container);
int extracted = Math.min(energy, stored);
if(!simulate)
{
stored -= extracted;
ItemNBTHelper.setInt(container, "energy", stored);
}
return extracted;
}
public static int getFluxStoredInItem(ItemStack container)
{
return getInt(container, "energy");
}
public static ItemStack stackWithData(ItemStack stack, Object... data)
{
assert(data.length%2==0);
for(int i=0; i<data.length/2; i++)
{
Object key = data[i];
Object value = data[i+1];
if(key instanceof String)
{
if(value instanceof Boolean)
setBoolean(stack, (String)key, (Boolean)value);
else if(value instanceof Integer)
setInt(stack, (String)key, (Integer)value);
else if(value instanceof Float)
setFloat(stack, (String)key, (Float)value);
else if(value instanceof Long)
setLong(stack, (String)key, (Long)value);
else if(value instanceof String)
setString(stack, (String)key, (String)value);
else if(value instanceof NBTTagCompound)
setTagCompound(stack, (String)key, (NBTTagCompound)value);
else if(value instanceof int[])
setIntArray(stack, (String)key, (int[])value);
else if(value instanceof ItemStack)
setItemStack(stack, (String)key, (ItemStack)value);
else if(value instanceof FluidStack)
setFluidStack(stack, (String)key, (FluidStack)value);
}
}
return stack;
}
}

View File

@ -1,459 +0,0 @@
package fr.jackcartersmith.orbsat.common.util;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector3f;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.Vec3d;
/**
* Copyright (C) 2013 Chicken-Bones
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
//This file originally copied from CodeChickenLib, courtesy of Chicken-Bones.
//This is a customized version created by Steven Blom (AtomicBlom) of the Steam and Steel development team.
//Slight adjustments have been made to fit my code.
//And massive adjustments made to work with 1.8. BLARGH!
public class Matrix4
{
//m<row><column>
public double m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33;
public Matrix4()
{
m00 = m11 = m22 = m33 = 1;
}
public Matrix4(double d00, double d01, double d02, double d03,
double d10, double d11, double d12, double d13,
double d20, double d21, double d22, double d23,
double d30, double d31, double d32, double d33)
{
m00 = d00;
m01 = d01;
m02 = d02;
m03 = d03;
m10 = d10;
m11 = d11;
m12 = d12;
m13 = d13;
m20 = d20;
m21 = d21;
m22 = d22;
m23 = d23;
m30 = d30;
m31 = d31;
m32 = d32;
m33 = d33;
}
public Matrix4(Matrix4 mat)
{
set(mat);
}
public Matrix4(Matrix4f mat)
{
m00 = mat.m00;
m01 = mat.m01;
m02 = mat.m02;
m03 = mat.m03;
m10 = mat.m10;
m11 = mat.m11;
m12 = mat.m12;
m13 = mat.m13;
m20 = mat.m20;
m21 = mat.m21;
m22 = mat.m22;
m23 = mat.m23;
m30 = mat.m30;
m31 = mat.m31;
m32 = mat.m32;
m33 = mat.m33;
}
public Matrix4(EnumFacing facing)
{
this();
setIdentity();
translate(.5, .5, .5);
switch(facing)
{
case UP:
rotate(Math.PI/2, 1, 0, 0);
break;
case DOWN:
rotate(-Math.PI/2, 1, 0, 0);
break;
case SOUTH:
rotate(Math.PI, 0, 1, 0);
break;
case EAST:
rotate(-Math.PI/2, 0, 1, 0);
break;
case WEST:
rotate(Math.PI/2, 0, 1, 0);
break;
case NORTH:
}
translate(-.5, -.5, -.5);
}
public Matrix4 setIdentity()
{
m00 = m11 = m22 = m33 = 1;
m01 = m02 = m03 = m10 = m12 = m13 = m20 = m21 = m23 = m30 = m31 = m32 = 0;
return this;
}
public Matrix4 translate(Vector3f vec)
{
m03 += m00 * vec.x + m01 * vec.y + m02 * vec.z;
m13 += m10 * vec.x + m11 * vec.y + m12 * vec.z;
m23 += m20 * vec.x + m21 * vec.y + m22 * vec.z;
m33 += m30 * vec.x + m31 * vec.y + m32 * vec.z;
return this;
}
public Matrix4 translate(double x, double y, double z)
{
m03 += m00 * x + m01 * y + m02 * z;
m13 += m10 * x + m11 * y + m12 * z;
m23 += m20 * x + m21 * y + m22 * z;
m33 += m30 * x + m31 * y + m32 * z;
return this;
}
public Matrix4 scale(Vector3f vec)
{
m00 *= vec.x;
m10 *= vec.x;
m20 *= vec.x;
m30 *= vec.x;
m01 *= vec.y;
m11 *= vec.y;
m21 *= vec.y;
m31 *= vec.y;
m02 *= vec.z;
m12 *= vec.z;
m22 *= vec.z;
m32 *= vec.z;
return this;
}
public Matrix4 scale(double x, double y, double z)
{
m00 *= x;
m10 *= x;
m20 *= x;
m30 *= x;
m01 *= y;
m11 *= y;
m21 *= y;
m31 *= y;
m02 *= z;
m12 *= z;
m22 *= z;
m32 *= z;
return this;
}
public Matrix4 rotate(double angle, Vector3f axis)
{
double c = Math.cos(angle);
double s = Math.sin(angle);
double mc = 1.0f - c;
double xy = axis.x*axis.y;
double yz = axis.y*axis.z;
double xz = axis.x*axis.z;
double xs = axis.x*s;
double ys = axis.y*s;
double zs = axis.z*s;
double f00 = axis.x*axis.x*mc+c;
double f10 = xy*mc+zs;
double f20 = xz*mc-ys;
double f01 = xy*mc-zs;
double f11 = axis.y*axis.y*mc+c;
double f21 = yz*mc+xs;
double f02 = xz*mc+ys;
double f12 = yz*mc-xs;
double f22 = axis.z*axis.z*mc+c;
double t00 = m00 * f00 + m01 * f10 + m02 * f20;
double t10 = m10 * f00 + m11 * f10 + m12 * f20;
double t20 = m20 * f00 + m21 * f10 + m22 * f20;
double t30 = m30 * f00 + m31 * f10 + m32 * f20;
double t01 = m00 * f01 + m01 * f11 + m02 * f21;
double t11 = m10 * f01 + m11 * f11 + m12 * f21;
double t21 = m20 * f01 + m21 * f11 + m22 * f21;
double t31 = m30 * f01 + m31 * f11 + m32 * f21;
m02 = m00 * f02 + m01 * f12 + m02 * f22;
m12 = m10 * f02 + m11 * f12 + m12 * f22;
m22 = m20 * f02 + m21 * f12 + m22 * f22;
m32 = m30 * f02 + m31 * f12 + m32 * f22;
m00 = t00;
m10 = t10;
m20 = t20;
m30 = t30;
m01 = t01;
m11 = t11;
m21 = t21;
m31 = t31;
return this;
}
public Matrix4 rotate(double angle, double x, double y, double z)
{
double c = Math.cos(angle);
double s = Math.sin(angle);
double mc = 1.0f - c;
double xy = x*y;
double yz = y*z;
double xz = x*z;
double xs = x*s;
double ys = y*s;
double zs = z*s;
double f00 = x*x*mc+c;
double f10 = xy*mc+zs;
double f20 = xz*mc-ys;
double f01 = xy*mc-zs;
double f11 = y*y*mc+c;
double f21 = yz*mc+xs;
double f02 = xz*mc+ys;
double f12 = yz*mc-xs;
double f22 = z*z*mc+c;
double t00 = m00 * f00 + m01 * f10 + m02 * f20;
double t10 = m10 * f00 + m11 * f10 + m12 * f20;
double t20 = m20 * f00 + m21 * f10 + m22 * f20;
double t30 = m30 * f00 + m31 * f10 + m32 * f20;
double t01 = m00 * f01 + m01 * f11 + m02 * f21;
double t11 = m10 * f01 + m11 * f11 + m12 * f21;
double t21 = m20 * f01 + m21 * f11 + m22 * f21;
double t31 = m30 * f01 + m31 * f11 + m32 * f21;
m02 = m00 * f02 + m01 * f12 + m02 * f22;
m12 = m10 * f02 + m11 * f12 + m12 * f22;
m22 = m20 * f02 + m21 * f12 + m22 * f22;
m32 = m30 * f02 + m31 * f12 + m32 * f22;
m00 = t00;
m10 = t10;
m20 = t20;
m30 = t30;
m01 = t01;
m11 = t11;
m21 = t21;
m31 = t31;
return this;
}
public Matrix4 leftMultiply(Matrix4 mat)
{
double n00 = m00 * mat.m00 + m10 * mat.m01 + m20 * mat.m02 + m30 * mat.m03;
double n01 = m01 * mat.m00 + m11 * mat.m01 + m21 * mat.m02 + m31 * mat.m03;
double n02 = m02 * mat.m00 + m12 * mat.m01 + m22 * mat.m02 + m32 * mat.m03;
double n03 = m03 * mat.m00 + m13 * mat.m01 + m23 * mat.m02 + m33 * mat.m03;
double n10 = m00 * mat.m10 + m10 * mat.m11 + m20 * mat.m12 + m30 * mat.m13;
double n11 = m01 * mat.m10 + m11 * mat.m11 + m21 * mat.m12 + m31 * mat.m13;
double n12 = m02 * mat.m10 + m12 * mat.m11 + m22 * mat.m12 + m32 * mat.m13;
double n13 = m03 * mat.m10 + m13 * mat.m11 + m23 * mat.m12 + m33 * mat.m13;
double n20 = m00 * mat.m20 + m10 * mat.m21 + m20 * mat.m22 + m30 * mat.m23;
double n21 = m01 * mat.m20 + m11 * mat.m21 + m21 * mat.m22 + m31 * mat.m23;
double n22 = m02 * mat.m20 + m12 * mat.m21 + m22 * mat.m22 + m32 * mat.m23;
double n23 = m03 * mat.m20 + m13 * mat.m21 + m23 * mat.m22 + m33 * mat.m23;
double n30 = m00 * mat.m30 + m10 * mat.m31 + m20 * mat.m32 + m30 * mat.m33;
double n31 = m01 * mat.m30 + m11 * mat.m31 + m21 * mat.m32 + m31 * mat.m33;
double n32 = m02 * mat.m30 + m12 * mat.m31 + m22 * mat.m32 + m32 * mat.m33;
double n33 = m03 * mat.m30 + m13 * mat.m31 + m23 * mat.m32 + m33 * mat.m33;
m00 = n00;
m01 = n01;
m02 = n02;
m03 = n03;
m10 = n10;
m11 = n11;
m12 = n12;
m13 = n13;
m20 = n20;
m21 = n21;
m22 = n22;
m23 = n23;
m30 = n30;
m31 = n31;
m32 = n32;
m33 = n33;
return this;
}
public Matrix4 multiply(Matrix4 mat)
{
double n00 = m00 * mat.m00 + m01 * mat.m10 + m02 * mat.m20 + m03 * mat.m30;
double n01 = m00 * mat.m01 + m01 * mat.m11 + m02 * mat.m21 + m03 * mat.m31;
double n02 = m00 * mat.m02 + m01 * mat.m12 + m02 * mat.m22 + m03 * mat.m32;
double n03 = m00 * mat.m03 + m01 * mat.m13 + m02 * mat.m23 + m03 * mat.m33;
double n10 = m10 * mat.m00 + m11 * mat.m10 + m12 * mat.m20 + m13 * mat.m30;
double n11 = m10 * mat.m01 + m11 * mat.m11 + m12 * mat.m21 + m13 * mat.m31;
double n12 = m10 * mat.m02 + m11 * mat.m12 + m12 * mat.m22 + m13 * mat.m32;
double n13 = m10 * mat.m03 + m11 * mat.m13 + m12 * mat.m23 + m13 * mat.m33;
double n20 = m20 * mat.m00 + m21 * mat.m10 + m22 * mat.m20 + m23 * mat.m30;
double n21 = m20 * mat.m01 + m21 * mat.m11 + m22 * mat.m21 + m23 * mat.m31;
double n22 = m20 * mat.m02 + m21 * mat.m12 + m22 * mat.m22 + m23 * mat.m32;
double n23 = m20 * mat.m03 + m21 * mat.m13 + m22 * mat.m23 + m23 * mat.m33;
double n30 = m30 * mat.m00 + m31 * mat.m10 + m32 * mat.m20 + m33 * mat.m30;
double n31 = m30 * mat.m01 + m31 * mat.m11 + m32 * mat.m21 + m33 * mat.m31;
double n32 = m30 * mat.m02 + m31 * mat.m12 + m32 * mat.m22 + m33 * mat.m32;
double n33 = m30 * mat.m03 + m31 * mat.m13 + m32 * mat.m23 + m33 * mat.m33;
m00 = n00;
m01 = n01;
m02 = n02;
m03 = n03;
m10 = n10;
m11 = n11;
m12 = n12;
m13 = n13;
m20 = n20;
m21 = n21;
m22 = n22;
m23 = n23;
m30 = n30;
m31 = n31;
m32 = n32;
m33 = n33;
return this;
}
public Matrix4 transpose()
{
double n00 = m00;
double n10 = m01;
double n20 = m02;
double n30 = m03;
double n01 = m10;
double n11 = m11;
double n21 = m12;
double n31 = m13;
double n02 = m20;
double n12 = m21;
double n22 = m22;
double n32 = m23;
double n03 = m30;
double n13 = m31;
double n23 = m32;
double n33 = m33;
m00 = n00;
m01 = n01;
m02 = n02;
m03 = n03;
m10 = n10;
m11 = n11;
m12 = n12;
m13 = n13;
m20 = n20;
m21 = n21;
m22 = n22;
m23 = n23;
m30 = n30;
m31 = n31;
m32 = n32;
m33 = n33;
return this;
}
public Matrix4 copy()
{
return new Matrix4(this);
}
public Matrix4 set(Matrix4 mat)
{
m00 = mat.m00;
m01 = mat.m01;
m02 = mat.m02;
m03 = mat.m03;
m10 = mat.m10;
m11 = mat.m11;
m12 = mat.m12;
m13 = mat.m13;
m20 = mat.m20;
m21 = mat.m21;
m22 = mat.m22;
m23 = mat.m23;
m30 = mat.m30;
m31 = mat.m31;
m32 = mat.m32;
m33 = mat.m33;
return this;
}
public void apply(Matrix4 mat)
{
mat.multiply(this);
}
private void mult3x3(Vector3f vec)
{
double x = m00 * vec.x + m01 * vec.y + m02 * vec.z;
double y = m10 * vec.x + m11 * vec.y + m12 * vec.z;
double z = m20 * vec.x + m21 * vec.y + m22 * vec.z;
vec.x = (float)x;
vec.y = (float)y;
vec.z = (float)z;
}
public void apply(Vector3f vec)
{
mult3x3(vec);
vec.x += m03;
vec.y += m13;
vec.z += m23;
}
private Vec3d mult3x3(Vec3d vec)
{
double x = m00 * vec.xCoord + m01 * vec.yCoord + m02 * vec.zCoord;
double y = m10 * vec.xCoord + m11 * vec.yCoord + m12 * vec.zCoord;
double z = m20 * vec.xCoord + m21 * vec.yCoord + m22 * vec.zCoord;
return new Vec3d(x,y,z);
}
public Vec3d apply(Vec3d vec)
{
return mult3x3(vec).addVector(m03, m13, m23);
}
private org.lwjgl.util.vector.Vector3f mult3x3(org.lwjgl.util.vector.Vector3f vec)
{
float x = (float) (m00 * vec.x + m01 * vec.y + m02 * vec.z);
float y = (float) (m10 * vec.x + m11 * vec.y + m12 * vec.z);
float z = (float) (m20 * vec.x + m21 * vec.y + m22 * vec.z);
return new org.lwjgl.util.vector.Vector3f(x, y, z);
}
public org.lwjgl.util.vector.Vector3f apply(org.lwjgl.util.vector.Vector3f vec)
{
org.lwjgl.util.vector.Vector3f vec2 = mult3x3(vec);
vec2.x += m03;
vec2.y += m13;
vec2.z += m23;
return vec2;
}
public Matrix4f toMatrix4f()
{
return new Matrix4f((float)m00,(float)m01,(float)m02,(float)m03, (float)m10,(float)m11,(float)m12,(float)m13, (float)m20,(float)m21,(float)m22,(float)m23, (float)m30,(float)m31,(float)m32,(float)m33);
}
public void fromMatrix4f(Matrix4f mat)
{
m00 = mat.m00; m01 = mat.m01; m02 = mat.m02; m03 = mat.m03;
m10 = mat.m10; m11 = mat.m11; m12 = mat.m12; m13 = mat.m13;
m20 = mat.m20; m21 = mat.m21; m22 = mat.m22; m23 = mat.m23;
m30 = mat.m30; m31 = mat.m31; m32 = mat.m32; m33 = mat.m33;
}
public final void invert()
{
Matrix4f temp = toMatrix4f();
temp.invert();
this.fromMatrix4f(temp);
}
@Override
public String toString()
{
MathContext cont = new MathContext(4, RoundingMode.HALF_UP);
return "["+new BigDecimal(m00, cont)+","+new BigDecimal(m01, cont)+","+new BigDecimal(m02, cont)+","+new BigDecimal(m03, cont)+"]\n"+
"["+new BigDecimal(m10, cont)+","+new BigDecimal(m11, cont)+","+new BigDecimal(m12, cont)+","+new BigDecimal(m13, cont)+"]\n"+
"["+new BigDecimal(m20, cont)+","+new BigDecimal(m21, cont)+","+new BigDecimal(m22, cont)+","+new BigDecimal(m23, cont)+"]\n"+
"["+new BigDecimal(m30, cont)+","+new BigDecimal(m31, cont)+","+new BigDecimal(m32, cont)+","+new BigDecimal(m33, cont)+"]";
}
}

View File

@ -1,34 +0,0 @@
package fr.jackcartersmith.orbsat.common.util;
import org.apache.logging.log4j.Level;
import net.minecraftforge.fml.common.FMLLog;
public class OSLogger {
public static boolean debug = false;
public static void log(Level logLevel, Object object)
{
FMLLog.log("orbsat", 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 debug(Object object)
{
// if(debug)
// log(Level.INFO, "[DEBUG:] "+object);
}
}

View File

@ -1,93 +0,0 @@
package fr.jackcartersmith.orbsat.item;
import java.util.List;
import fr.jackcartersmith.orbsat.OSRefs;
import fr.jackcartersmith.orbsat.OrbitalSatellite;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemOSBase extends Item{
public String itemName;
protected String[] subNames;
boolean[] isMetaHidden;
public boolean registerSubModels=true;
public ItemOSBase(String name, int stackSize, String... subNames){
this.setUnlocalizedName(OSRefs.MODID+"."+name);
this.setHasSubtypes(subNames!=null&&subNames.length>0);
this.setCreativeTab(OrbitalSatellite.creativeTab);
this.setMaxStackSize(stackSize);
this.itemName = name;
this.subNames = subNames!=null&&subNames.length>0?subNames:null;
this.isMetaHidden = new boolean[this.subNames!=null?this.subNames.length:1];
OrbitalSatellite.register(this, name);
OSRefs.registeredOSItems.add(this);
}
public String[] getSubNames()
{
return subNames;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list)
{
if(getSubNames()!=null)
{
for(int i=0;i<getSubNames().length;i++)
if(!isMetaHidden(i))
list.add(new ItemStack(this,1,i));
}
else
list.add(new ItemStack(this));
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
if(getSubNames()!=null)
{
String subName = stack.getItemDamage()<getSubNames().length?getSubNames()[stack.getItemDamage()]:"";
return this.getUnlocalizedName()+"."+subName;
}
return this.getUnlocalizedName();
}
public ItemOSBase setMetaHidden(int... meta)
{
for(int i : meta)
if(i>=0 && i<this.isMetaHidden.length)
this.isMetaHidden[i] = true;
return this;
}
public ItemOSBase setMetaUnhidden(int... meta)
{
for(int i : meta)
if(i>=0 && i<this.isMetaHidden.length)
this.isMetaHidden[i] = false;
return this;
}
public boolean isMetaHidden(int meta)
{
return this.isMetaHidden[Math.max(0, Math.min(meta, this.isMetaHidden.length-1))];
}
public ItemOSBase setRegisterSubModels(boolean register)
{
this.registerSubModels = register;
return this;
}
}

View File

@ -1,63 +0,0 @@
package fr.jackcartersmith.orbsat.models.obj;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import fr.jackcartersmith.orbsat.common.util.OSLogger;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ICustomModelLoader;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.client.model.obj.OBJModel;
public class OSOBJLoader implements ICustomModelLoader{
private IResourceManager manager;
private final Set<String> enabledDomains = new HashSet<String>();
private final Map<ResourceLocation, OSOBJModel> cache = new HashMap<ResourceLocation, OSOBJModel>();
private final Map<ResourceLocation, Exception> errors = new HashMap<ResourceLocation, Exception>();
public static OSOBJLoader instance = new OSOBJLoader();
public void addDomain(String domain)
{
enabledDomains.add(domain.toLowerCase(Locale.ENGLISH));
OSLogger.info("[OrbSAT] Custom OBJLoader: Domain has been added: "+domain.toLowerCase(Locale.ENGLISH));
}
@Override
public boolean accepts(ResourceLocation modelLocation)
{
return enabledDomains.contains(modelLocation.getResourceDomain()) && modelLocation.getResourcePath().endsWith(".obj.adv");
}
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception
{
ResourceLocation file = new ResourceLocation(modelLocation.getResourceDomain(), modelLocation.getResourcePath());
if(!cache.containsKey(file))
{
IModel model = OBJLoader.INSTANCE.loadModel(modelLocation);
if(model instanceof OBJModel)
{
OSOBJModel osobj = new OSOBJModel(((OBJModel)model).getMatLib(), file);
cache.put(modelLocation, osobj);
}
}
OSOBJModel model = cache.get(file);
if(model == null)
return ModelLoaderRegistry.getMissingModel();
return model;
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager)
{
this.manager = resourceManager;
cache.clear();
errors.clear();
}
}

View File

@ -1,96 +0,0 @@
package fr.jackcartersmith.orbsat.models.obj;
import java.lang.reflect.Field;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.obj.OBJModel;
import net.minecraftforge.common.model.IModelState;
public class OSOBJModel extends OBJModel{
public OSOBJModel(MaterialLibrary matLib, ResourceLocation modelLocation)
{
super(matLib, modelLocation);
}
public OSOBJModel(MaterialLibrary matLib, ResourceLocation modelLocation, Object customData)
{
super(matLib, modelLocation);
this.setCustomData(customData);
}
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
IBakedModel preBaked = super.bake(state, format, bakedTextureGetter);
//return new OSSmartObjModel(preBaked, this, state, format, OSSmartObjModel.getTexturesForOBJModel(preBaked), null);
return preBaked;
}
@Override
public IModel process(ImmutableMap<String, String> customData)
{
OSOBJModel ret = new OSOBJModel(this.getMatLib(), getResourceLocation(), getCustomData());
return ret;
}
@Override
public IModel retexture(ImmutableMap<String, String> textures)
{
OSOBJModel ret = new OSOBJModel(this.getMatLib().makeLibWithReplacements(textures), getResourceLocation(), getCustomData());
return ret;
}
static Field f_modelLocation;
public ResourceLocation getResourceLocation()
{
try{
if(f_modelLocation==null)
{
f_modelLocation = OBJModel.class.getDeclaredField("modelLocation");
f_modelLocation.setAccessible(true);
}
if(f_modelLocation!=null)
return (ResourceLocation)f_modelLocation.get(this);
}catch(Exception e){
e.printStackTrace();
}
return null;
}
static Field f_customData;
public Object getCustomData()
{
try{
if(f_customData==null)
{
f_customData = OBJModel.class.getDeclaredField("customData");
f_customData.setAccessible(true);
}
if(f_customData!=null)
return f_customData.get(this);
}catch(Exception e){
e.printStackTrace();
}
return null;
}
public void setCustomData(Object data)
{
try{
if(f_customData==null)
{
f_customData = OBJModel.class.getDeclaredField("customData");
f_customData.setAccessible(true);
}
if(f_customData!=null)
f_customData.set(this, data);
}catch(Exception e){
e.printStackTrace();
}
}
}

View File

@ -1,93 +0,0 @@
{
"forge_marker": 1,
"defaults":
{
"transform": "forge:default-block",
"model": "orbsat:osSixSides",
"textures": {
"bottom": "orbsat:blocks/device_base",
"top": "orbsat:blocks/device_base",
"north": "orbsat:blocks/device_base",
"south": "orbsat:blocks/device_base",
"west": "orbsat:blocks/device_base",
"east": "orbsat:blocks/device_base",
"sideOff": "orbsat:blocks/device_base",
"sideOn": "orbsat:blocks/device_base"
}
},
"variants": {
"inventory,type=satellite_launcher": [{"textures": {
"bottom": "orbsat:blocks/device_base",
"top": "orbsat:blocks/device_base",
"north": "orbsat:blocks/device_satelliteLauncher_front",
"south": "orbsat:blocks/device_satelliteLauncher_back",
"west": "orbsat:blocks/device_satelliteLauncher_side",
"east": "orbsat:blocks/device_satelliteLauncher_side"}
}],
"inventory,type=satellite_centrale": [{"textures": {
"bottom": "orbsat:blocks/device_base",
"top": "orbsat:blocks/device_base",
"north": "orbsat:blocks/device_base",
"south": "orbsat:blocks/device_base",
"west": "orbsat:blocks/device_base",
"east": "orbsat:blocks/device_base"}
}],
"inventory,type=satellite_assembler": [{
"model": "orbsat:satellite_assembler.obj",
"custom": {"flip-v": true},
"transform": {
"scale": [ 0.1875, 0.1875, 0.1875 ],
"firstperson_righthand": { "scale": [ 0.75, 0.75, 0.75 ], "rotation": [{ "y": 90 }] },
"firstperson_lefthand": { "scale": [ 0.75, 0.75, 0.75 ], "rotation": [{ "y": 90 }] },
"thirdperson_righthand": { "translation": [ 0, 0.09375, -0.171875 ], "rotation": [{ "x": 70 }, { "y": 70 }] },
"thirdperson_lefthand": { "translation": [ 0, 0.09375, -0.171875 ], "rotation": [{ "x": 70 }, { "y": 70 }] },
"fixed": {"scale": [ 2,2,2 ], "translation": [ 0, -0.25, 0 ], "rotation": [{ "y": 0 }]},
"gui": { "translation": [ 0, -0.25, 0 ], "rotation": [{ "x": 30 },{ "y": 135 }], "scale": [ 1.5, 1.5, 1.5 ] }
}
}],
"type=satellite_assembler": {
"model": "orbsat:satellite_assembler.obj",
"custom": { "flip-v": true }
},
"type=satellite_launcher": {"parent":"block/cube_all", "textures": {
"bottom": "orbsat:blocks/device_base",
"top": "orbsat:blocks/device_base",
"north": "orbsat:blocks/device_satelliteLauncher_front",
"south": "orbsat:blocks/device_satelliteLauncher_back",
"west": "orbsat:blocks/device_satelliteLauncher_side",
"east": "orbsat:blocks/device_satelliteLauncher_side",
"sideOff": "#sideOff",
"sideOn": "#sideOff"
}},
"type=satellite_centrale": {"parent":"block/cube_all", "textures": {
"bottom": "orbsat:blocks/device_base",
"top": "orbsat:blocks/device_base",
"north": "orbsat:blocks/device_base",
"south": "orbsat:blocks/device_base",
"west": "orbsat:blocks/device_base",
"east": "orbsat:blocks/device_base"
}},
"facing":
{
"down": { "transform": {
"rotation": {"x": -90 }
}},
"up": { "transform": {
"rotation": {"x": 90 }
}},
"north": { "transform": {
"rotation": {"y": 0 }
}},
"south": { "transform": {
"rotation": {"y": 180 }
}},
"west": { "transform": {
"rotation": {"y": 90 }
}},
"east": { "transform": {
"rotation": {"y": -90 }
}}
}
}
}

View File

@ -1,11 +0,0 @@
#CreativeTabs
itemGroup.orbsat=Orbital Satellite
#Items
item.orbsat.components.laserDesignator.name=Targeting Satellite Computer
item.orbsat.components.designatorCircuit.name=Targeting Computer Circuit
item.orbsat.components.photonLens.name=Lens
item.orbsat.components.photonConcentrator.name=Photon Concentrator
item.orbsat.components.photonCapacitor.name=Photon Capacitor
item.orbsat.satellites.classic_mki.name=Classic Laser Satellite MK-I
item.orbsat.satellites.classic_mkii.name=Classic Laser Satellite MK-II
item.orbsat.satellites.classic_mkiii.name=Classic Laser Satellite MK-III

View File

@ -1,11 +0,0 @@
#CreativeTabs
itemGroup.orbsat=Satellite Orbital
#Items
item.orbsat.components.laserDesignator.name=Ordinateur de visée du satellite
item.orbsat.components.designatorCircuit.name=Circuit pour ordinateur de visée
item.orbsat.components.photonLens.name=Lentille
item.orbsat.components.photonConcentrator.name=Concentrateur à photon
item.orbsat.components.photonCapacitor.name=Condensateur à photon
item.orbsat.satellites.classic_mki.name=Satellite classique de frappe laser MK-I
item.orbsat.satellites.classic_mkii.name=Satellite classique de frappe laser MK-II
item.orbsat.satellites.classic_mkiii.name=Satellite classique de frappe laser MK-III

View File

@ -1,18 +0,0 @@
{
"elements": [{
"from": [ 0,0,0 ],
"to": [ 16,16,16 ],
"faces": {
"down": { "texture": "orbsat:blocks/device_base", "uv": [0,0,16,16] },
"up": { "texture": "orbsat:blocks/device_base", "uv": [0,0,16,16] },
"north": { "texture": "orbsat:blocks/device_base", "uv": [0,0,16,16] },
"south": { "texture": "orbsat:blocks/device_base", "uv": [0,0,16,16] },
"west": { "texture": "orbsat:blocks/device_base", "uv": [0,0,16,16] },
"east": { "texture": "orbsat:blocks/device_base", "uv": [0,0,16,16] }
}
}],
"textures":
{
"particle": "orbsat:blocks/device_base"
}
}

View File

@ -1,2 +0,0 @@
newmtl satellite_assembler
map_Ka orbsat:blocks/satellite_assembler

View File

@ -1,135 +0,0 @@
mtllib satellite_assembler.mtl
o fab_lab
v 0.996472 0.997981 -1.822489
v 0.996472 2.998219 -1.822489
v 1.692860 0.997981 -1.487127
v 1.692860 2.998219 -1.487127
v 1.864854 0.997981 -0.733574
v 1.864854 2.998219 -0.733574
v 1.382938 0.997981 -0.129271
v 1.382938 2.998219 -0.129271
v 0.610006 0.997981 -0.129271
v 0.610006 2.998219 -0.129271
v 0.128091 0.997981 -0.733573
v 0.128091 2.998219 -0.733573
v 0.300084 0.997981 -1.487127
v 0.300084 2.998219 -1.487127
vt 0.5000 0.5937
vt 0.5000 0.1250
vt 0.6562 0.1250
vt 0.6562 0.5938
vt 0.2500 0.6250
vt 0.2500 0.1250
vt 0.5000 0.1250
vt 0.5000 0.6250
vt 0.2500 0.1250
vt 0.2500 0.6250
vt 0.2500 0.1250
vt 0.2500 0.5000
vt 0.0000 0.5000
vt 0.0000 0.1250
vt 0.2500 0.6250
vt 0.2500 0.1250
vt 0.5000 0.1250
vt 0.5000 0.6250
vt 0.2500 0.1250
vt 0.2500 0.6250
vt 0.6562 0.5938
vt 0.6562 0.1250
vt 0.5000 0.5938
vt 0.1289 0.7579
vt 0.2717 0.7382
vt 0.2815 0.6546
vt 0.2028 0.6309
vt 0.1417 0.5857
vt 0.0896 0.6319
vt 0.1014 0.7018
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
usemtl satellite_assembler
f 1/1 2/2 4/3 3/4
f 3/5 4/6 6/7 5/8
f 5/8 6/7 8/9 7/10
f 7/11 8/12 10/13 9/14
f 9/15 10/16 12/17 11/18
f 11/18 12/17 14/19 13/20
f 13/21 14/22 2/2 1/23
f 1/24 3/25 5/26 7/27 9/28 11/29 13/30
o constructor
v 0.129361 1.000636 -1.875538
v 0.129361 0.240983 -1.875539
v 0.129361 1.000636 -0.124046
v 0.129361 0.240983 -0.124047
v 1.871430 1.000636 -1.875538
v 1.871430 0.240983 -1.875539
v 1.871430 1.000636 -0.124046
v 1.871430 0.240983 -0.124047
vt 0.5000 0.6250
vt 0.2500 0.6250
vt 0.2500 0.1250
vt 0.5000 0.1250
vt 0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.1250
vt 0.0000 0.1250
vt 0.2500 0.1250
vt 0.5000 0.1250
vt 0.5000 0.6250
vt 0.2500 0.6250
vt 0.5000 0.1250
vt 0.2500 0.1250
vt 0.7188 0.7812
vt 0.7188 1.0000
vt 0.0000 1.0000
vt 0.0000 0.7812
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
usemtl satellite_assembler
f 15/38 16/39 18/40 17/41
f 17/42 18/43 22/44 21/45
f 21/46 22/47 20/48 19/49
f 19/49 20/48 16/50 15/51
f 17/52 21/53 19/54 15/55
o base
v 0.000000 0.000000 0.004289
v 0.000000 0.244858 0.004289
v 0.000000 0.000000 -1.995711
v 0.000000 0.244858 -1.995711
v 2.000000 0.000000 0.004289
v 2.000000 0.244858 0.004289
v 2.000000 0.000000 -1.995711
v 2.000000 0.244858 -1.995711
vt 0.7500 0.0000
vt 0.7500 0.1250
vt 0.0000 0.1250
vt 0.0000 0.0000
vt 0.7500 0.0000
vt 0.7500 0.1250
vt 0.0000 0.1250
vt 0.0000 0.0000
vt 0.7499 0.0000
vt 0.7500 0.1246
vt 0.0000 0.1246
vt 0.0000 0.0000
vt 0.7500 0.0000
vt 0.7500 0.1250
vt 0.0000 0.1250
vt 0.0000 0.0000
vt 0.7188 0.7812
vt 0.7188 1.0000
vt 0.0000 1.0000
vt 0.0000 0.7812
# vt -0.2500 -0.0000
usemtl satellite_assembler
f 23/60 24/61 26/62 25/63
f 25/64 26/65 30/66 29/67
f 29/68 30/69 28/70 27/71
f 27/72 28/73 24/74 23/75
f 30/76 26/77 24/78 28/79

View File

@ -1,6 +0,0 @@
{
"parent": "orbsat:item/flat",
"textures": {
"layer0": "orbsat:items/designatorCircuit"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "orbsat:item/flat",
"textures": {
"layer0": "orbsat:items/laserDesignator"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "orbsat:item/flat",
"textures": {
"layer0": "orbsat:items/photonCapacitor"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "orbsat:item/flat",
"textures": {
"layer0": "orbsat:items/photonConcentrator"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "orbsat:item/flat",
"textures": {
"layer0": "orbsat:items/photonLens"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "missingno"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "orbsat:item/flat",
"textures": {
"layer0": "orbsat:items/classicSatellite_mki"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "orbsat:item/flat",
"textures": {
"layer0": "orbsat:items/classicSatellite_mkii"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "orbsat:item/flat",
"textures": {
"layer0": "orbsat:items/classicSatellite_mkiii"
}
}

View File

@ -1,6 +0,0 @@
{
"parent":"orbsat:item/flat",
"textures": {
"layer0":"orbsat:items/railgun"
}
}

View File

@ -1,2 +0,0 @@
newmtl railgun
map_Ka orbsat:items/railgun

View File

@ -1,62 +0,0 @@
{
"defenderLock": {
"category": "block",
"sounds": [
"orbsat:defenderLock"
]
},
"start": {
"category": "block",
"sounds": [
"orbsat:start"
]
},
"middle": {
"category": "block",
"sounds": [
"orbsat:middle"
]
},
"satelliteLaunch": {
"category": "block",
"sounds": [
"orbsat:satelliteLaunch"
]
},
"explode": {
"category": "block",
"sounds": [
"orbsat:explode"
]
},
"reentry": {
"category": "block",
"sounds": [
"orbsat:reentry"
]
},
"booming": {
"category": "block",
"sounds": [
"orbsat:booming"
]
},
"digging": {
"category": "block",
"sounds": [
"orbsat:digging"
]
},
"startCharging": {
"category": "block",
"sounds": [
"orbsat:startCharging"
]
},
"helios": {
"category": "block",
"sounds": [
"orbsat:helios"
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,15 +0,0 @@
{
"animation": {
"frametime": 1,
"frames": [
{ "index": 0, "time": 2 },
{ "index": 1, "time": 2 },
{ "index": 2, "time": 2 },
{ "index": 3, "time": 2 },
{ "index": 4, "time": 2 },
{ "index": 5, "time": 2 },
{ "index": 6, "time": 2 },
{ "index": 7, "time": 2 }
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 B

View File

@ -1,15 +1,16 @@
[
{
"modid": "orbsat",
"name": "Orbital Satellite",
"description": "Big laser, big construct, big boom !",
"modid": "examplemod",
"name": "Example Mod",
"description": "Example placeholder mod.",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
"authorList": ["JackCarterSmith"],
"authorList": ["ExampleDude"],
"credits": "The Forge and FML guys, for making this example",
"logoFile": "",
"screenshots": [],
"dependencies": ["CompatLayer"]
"dependencies": []
}
]

View File

@ -1,6 +1,7 @@
{
"pack": {
"pack_format": 1,
"description": "Resources used for Orbital Satellite"
}
}
"pack": {
"description": "examplemod resources",
"pack_format": 3,
"_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)."
}
}