Initial commit

This commit is contained in:
pjht 2018-03-12 20:09:50 -05:00
commit ab642e20d0
43 changed files with 1066 additions and 0 deletions

22
.gitignore vendored Normal file
View File

@ -0,0 +1,22 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
# idea
out
*.ipr
*.iws
*.iml
.idea
# gradle
build
.gradle
# other
eclipse
run

77
build.gradle Normal file
View File

@ -0,0 +1,77 @@
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 = "1.0"
group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12-14.21.1.2443"
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 = "snapshot_20170624"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
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

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#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.14-bin.zip

164
gradlew vendored Executable file
View File

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View File

@ -0,0 +1,72 @@
package com.pjht.mesystem;
import com.pjht.mesystem.block.ModBlocks;
import com.pjht.mesystem.item.ModItems;
import com.pjht.mesystem.proxy.CommonProxy;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
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.eventhandler.SubscribeEvent;
@Mod(modid = MESystem.modId, name = MESystem.name, version = MESystem.version)
public class MESystem {
public static final String modId = "mesystem";
public static final String name = "ME System addon for SSSP";
public static final String version = "1.0.0";
@Mod.Instance(modId)
public static MESystem instance;
@SidedProxy(serverSide = "com.pjht.mesystem.proxy.CommonProxy", clientSide = "com.pjht.mesystem.proxy.ClientProxy")
public static CommonProxy proxy;
public static final MESystemTab creativeTab = new MESystemTab();
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
System.out.println(name + " is loading!");
ModItems.init();
ModBlocks.init();
}
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
ModItems.initOreDict();
ModBlocks.initOreDict();
ModRecipes.init();
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
}
@Mod.EventBusSubscriber
public static class RegistrationHandler {
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
ModItems.register(event.getRegistry());
ModBlocks.registerItemBlocks(event.getRegistry());
}
@SubscribeEvent
public static void registerItems(ModelRegistryEvent event) {
ModItems.registerModels();
ModBlocks.registerItemModels();
}
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
ModBlocks.register(event.getRegistry());
}
}
}

View File

@ -0,0 +1,19 @@
package com.pjht.mesystem;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class MESystemTab extends CreativeTabs {
public MESystemTab() {
super(MESystem.modId);
}
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Items.AIR);
}
}

View File

@ -0,0 +1,13 @@
package com.pjht.mesystem;
import com.pjht.mesystem.block.ModBlocks;
import com.pjht.mesystem.item.ModItems;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ModRecipes {
public static void init() {
GameRegistry.addSmelting(ModBlocks.blocks.get("oreCopper"), new ItemStack(ModItems.items.get("ingotCopper")), 0.7f);
}
}

View File

@ -0,0 +1,54 @@
package com.pjht.mesystem.block;
import com.pjht.mesystem.MESystem;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntity;
public class BlockBase extends Block {
protected String name;
public BlockBase(Material material, String name) {
super(material);
this.name = name;
setUnlocalizedName(name);
setRegistryName(name);
setCreativeTab(MESystem.creativeTab);
}
public void registerItemModel(Item itemBlock) {
MESystem.proxy.registerItemRenderer(itemBlock, 0, name);
}
public Item createItemBlock() {
return new ItemBlock(this).setRegistryName(getRegistryName());
}
@Override
public BlockBase setCreativeTab(CreativeTabs tab) {
super.setCreativeTab(tab);
return this;
}
public Boolean isTileEntity() {
return false;
}
public Boolean isOredict() {
return false;
}
public Class<? extends TileEntity> getTileEntityClass() {
return null;
}
public void initOreDict() {
}
}

View File

@ -0,0 +1,33 @@
package com.pjht.mesystem.block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.oredict.OreDictionary;
public class BlockOre extends BlockBase {
private String oreName;
public BlockOre(String name, String oreName) {
super(Material.ROCK, name);
this.oreName = oreName;
setHardness(3f);
setResistance(5f);
}
public void initOreDict() {
OreDictionary.registerOre(oreName, this);
}
@Override
public BlockOre setCreativeTab(CreativeTabs tab) {
super.setCreativeTab(tab);
return this;
}
@Override
public Boolean isOredict() {
return true;
}
}

View File

@ -0,0 +1,59 @@
package com.pjht.mesystem.block;
import java.util.HashMap;
import java.util.Map;
import com.pjht.mesystem.block.te.BlockTileEntity;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;
public class ModBlocks {
public static Map<String,BlockBase> blocks = new HashMap<String,BlockBase>();
public static void init() {
}
public static void register(IForgeRegistry<Block> registry) {
for (BlockBase block: blocks.values()) {
registry.register(block);
if (block.isTileEntity()) {
GameRegistry.registerTileEntity(block.getTileEntityClass(), block.getRegistryName().toString());
}
}
}
public static void registerItemBlocks(IForgeRegistry<Item> registry) {
for (BlockBase block: blocks.values()) {
registry.register(block.createItemBlock());
}
}
public static void registerItemModels() {
for (BlockBase block: blocks.values()) {
block.registerItemModel(Item.getItemFromBlock(block));
}
}
private static void registerBlock(Material material, String name) {
blocks.put(name, new BlockBase(material, name));
}
private static void registerOre(String name, String oredict) {
blocks.put(name, new BlockOre(name, oredict));
}
private static void registerTileEntity(String name, BlockTileEntity te) {
blocks.put(name, te);
}
public static void initOreDict() {
for (BlockBase block: blocks.values()) {
if (block.isOredict()) {
block.initOreDict();
}
}
}
}

View File

@ -0,0 +1,40 @@
package com.pjht.mesystem.block.te;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import com.pjht.mesystem.block.BlockBase;
public abstract class BlockTileEntity<TE extends TileEntity> extends BlockBase {
public BlockTileEntity(Material material, String name) {
super(material, name);
}
public abstract Class<TE> getTileEntityClass();
public TE getTileEntity(IBlockAccess world, BlockPos pos) {
return (TE)world.getTileEntity(pos);
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
}
@Nullable
@Override
public abstract TE createTileEntity(World world, IBlockState state);
@Override
public Boolean isTileEntity() {
return true;
}
}

View File

@ -0,0 +1,46 @@
package com.pjht.mesystem.block.te.counter;
import javax.annotation.Nullable;
import com.pjht.mesystem.block.te.BlockTileEntity;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
public class BlockCounter extends BlockTileEntity<TileEntityCounter> {
public BlockCounter() {
super(Material.ROCK, "counter");
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileEntityCounter tile = getTileEntity(world, pos);
if (side == EnumFacing.DOWN) {
tile.decrementCount();
} else if (side == EnumFacing.UP) {
tile.incrementCount();
}
player.sendMessage(new TextComponentString("Count: " + tile.getCount()));
}
return true;
}
@Override
public Class<TileEntityCounter> getTileEntityClass() {
return TileEntityCounter.class;
}
@Nullable
@Override
public TileEntityCounter createTileEntity(World world, IBlockState state) {
return new TileEntityCounter();
}
}

View File

@ -0,0 +1,36 @@
package com.pjht.mesystem.block.te.counter;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityCounter extends TileEntity {
private int count;
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setInteger("count", count);
return super.writeToNBT(compound);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
count = compound.getInteger("count");
super.readFromNBT(compound);
}
public int getCount() {
return count;
}
public void incrementCount() {
count++;
markDirty();
}
public void decrementCount() {
count--;
markDirty();
}
}

View File

@ -0,0 +1,86 @@
package com.pjht.mesystem.block.te.pedestal;
import javax.annotation.Nullable;
import com.pjht.mesystem.MESystem;
import com.pjht.mesystem.block.te.BlockTileEntity;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
public class BlockPedestal extends BlockTileEntity<TileEntityPedestal>{
public BlockPedestal() {
super(Material.ROCK, "pedestal");
}
@Override
@Deprecated
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
@Deprecated
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public Class<TileEntityPedestal> getTileEntityClass() {
return TileEntityPedestal.class;
}
@Nullable
@Override
public TileEntityPedestal createTileEntity(World world, IBlockState state) {
return new TileEntityPedestal();
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileEntityPedestal tile = getTileEntity(world, pos);
IItemHandler itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
if (!player.isSneaking()) {
if (player.getHeldItem(hand).isEmpty()) {
player.setHeldItem(hand, itemHandler.extractItem(0, 64, false));
} else {
player.setHeldItem(hand, itemHandler.insertItem(0, player.getHeldItem(hand), false));
}
tile.markDirty();
} else {
ItemStack stack = itemHandler.getStackInSlot(0);
if (!stack.isEmpty()) {
String localized = MESystem.proxy.localize(stack.getUnlocalizedName() + ".name");
player.sendMessage(new TextComponentString(stack.getCount() + "x " + localized));
} else {
player.sendMessage(new TextComponentString("Empty"));
}
}
}
return true;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
TileEntityPedestal tile = getTileEntity(world, pos);
IItemHandler itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.NORTH);
ItemStack stack = itemHandler.getStackInSlot(0);
if (!stack.isEmpty()) {
EntityItem item = new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), stack);
world.spawnEntity(item);
}
super.breakBlock(world, pos, state);
}
}

View File

@ -0,0 +1,39 @@
package com.pjht.mesystem.block.te.pedestal;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.ItemStackHandler;
public class TileEntityPedestal extends TileEntity {
private ItemStackHandler inventory = new ItemStackHandler(1);
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setTag("inventory", inventory.serializeNBT());
return super.writeToNBT(compound);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
inventory.deserializeNBT(compound.getCompoundTag("inventory"));
super.readFromNBT(compound);
}
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
}
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ? (T)inventory : super.getCapability(capability, facing);
}
}

View File

@ -0,0 +1,34 @@
package com.pjht.mesystem.item;
import com.pjht.mesystem.MESystem;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class ItemBase extends Item {
protected String name;
public ItemBase(String name) {
this.name = name;
setUnlocalizedName(name);
setRegistryName(name);
setCreativeTab(MESystem.creativeTab);
}
public void registerItemModel() {
MESystem.proxy.registerItemRenderer(this, 0, name);
}
@Override
public ItemBase setCreativeTab(CreativeTabs tab) {
super.setCreativeTab(tab);
return this;
}
public Boolean isOredict() {
return false;
}
public void initOreDict() {
}
}

View File

@ -0,0 +1,21 @@
package com.pjht.mesystem.item;
import net.minecraft.item.ItemStack;
public class ItemFuel extends ItemBase {
public String fuelName;
public int burnTime;
public ItemFuel(String name, String fuelName, int burnTime) {
super(name);
this.fuelName = fuelName;
this.burnTime = burnTime;
}
public int getItemBurnTime(ItemStack itemStack) {
return burnTime;
}
}

View File

@ -0,0 +1,23 @@
package com.pjht.mesystem.item;
import net.minecraftforge.oredict.OreDictionary;
public class ItemOre extends ItemBase {
private String oreName;
public ItemOre(String name, String oreName) {
super(name);
this.oreName = oreName;
}
public void initOreDict() {
OreDictionary.registerOre(oreName, this);
}
@Override
public Boolean isOredict() {
return true;
}
}

View File

@ -0,0 +1,53 @@
package com.pjht.mesystem.item;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.item.Item;
import net.minecraftforge.registries.IForgeRegistry;
public class ModItems {
public static Map<String,ItemBase> items = new HashMap<String,ItemBase>();
public static void init() {
registerItem("8080_chip");
registerItem("8080_ic");
registerItem("8080_blueprint");
registerItem("8080_pcb_blank");
registerItem("8080_pcb");
registerItem("8080_pcb_blueprint");
}
public static void register(IForgeRegistry<Item> registry) {
for (ItemBase item: items.values()) {
registry.register(item);
}
}
public static void registerModels() {
for (ItemBase item: items.values()) {
item.registerItemModel();
}
}
private static void registerItem(String name) {
items.put(name, new ItemBase(name));
}
private static void registerOredict(String name, String oredict) {
items.put(name, new ItemOre(name,oredict));
}
private static void registerFuel(String name, String fuelName, int burnTime) {
items.put(name, new ItemFuel(name, fuelName, burnTime));
}
public static void initOreDict() {
for (ItemBase item: items.values()) {
if (item.isOredict()) {
item.initOreDict();
}
}
}
}

View File

@ -0,0 +1,20 @@
package com.pjht.mesystem.proxy;
import com.pjht.mesystem.MESystem;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
public class ClientProxy extends CommonProxy {
@Override
public void registerItemRenderer(Item item, int meta, String id) {
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(MESystem.modId + ":" + id, "inventory"));
}
@Override
public String localize(String unlocalized, Object... args) {
return I18n.format(unlocalized, args);
}
}

View File

@ -0,0 +1,13 @@
package com.pjht.mesystem.proxy;
import net.minecraft.item.Item;
import net.minecraft.util.text.translation.I18n;
public class CommonProxy {
public void registerItemRenderer(Item item, int meta, String id) {
}
public String localize(String unlocalized, Object... args) {
return I18n.translateToLocalFormatted(unlocalized, args);
}
}

View File

@ -0,0 +1,11 @@
# Items
item.8080_chip.name=8080 Chip
item.8080_ic.name=8080 IC
item.8080_blueprint.name=8080 Chip Blueprint
item.8080_pcb_blank.name=Blank 8080 PCB
item.8080_pcb.name=8080 PCB
item.8080_pcb_blueprint.name=8080 PCB Blueprint
# Blocks
# Creative Tabs
itemGroup.mesystem=ME System

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "mesystem:items/8080_blueprint"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "mesystem:items/8080_chip"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "mesystem:items/8080_ic"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "mesystem:items/8080_pcb"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "mesystem:items/8080_pcb_blank"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "mesystem:items/8080_pcb_blueprint"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "mesystem:items/8080_pcb_blank"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ssspcore:blank_chip"
},
{
"item": "mesystem:8080_blueprint"
}
],
"result": {
"item": "mesystem:8080_chip"
}
}

View File

@ -0,0 +1,17 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ssspcore:housing"
},
{
"item": "mesystem:8080_chip"
},
{
"item": "minecraft:gold_nugget"
}
],
"result": {
"item": "mesystem:8080_ic"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "mesystem:8080_ic"
},
{
"item": "mesystem:8080_pcb_blank"
}
],
"result": {
"item": "mesystem:8080_pcb"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ssspcore:blank_pcb"
},
{
"item": "mesystem:8080_pcb_blueprint"
}
],
"result": {
"item": "mesystem:8080_pcb_blank"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

View File

@ -0,0 +1,15 @@
[
{
"modid": "mesystem",
"name": "ME System addon for SSSP",
"description": "SSSP ME System addon.",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
"authorList": ["Peter"],
"credits": "",
"logoFile": "",
"screenshots": []
}
]

View File

@ -0,0 +1,6 @@
{
"pack": {
"description": "Resources",
"pack_format": 3
}
}