Enough to get the game running

This commit is contained in:
modmuss50 2019-02-23 23:51:37 +00:00
parent b8f09d29b7
commit db3a6f2c7e
7 changed files with 76 additions and 26 deletions

View file

@ -77,6 +77,11 @@ minecraft {
techreborn {
source sourceSets.main
}
if (findProject(':reborncore') != null) {
reborncore {
source project(":reborncore").sourceSets.main
}
}
}
}

View file

@ -29,11 +29,15 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import reborncore.RebornCore;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.multiblock.MultiblockEventHandler;
import reborncore.common.multiblock.MultiblockServerTickHandler;
@ -60,7 +64,7 @@ public class TechReborn {
public static final String MOD_ID = "techreborn";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
// @SidedProxy(clientSide = TechReborn.CLIENT_PROXY_CLASS, serverSide = TechReborn.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
public static CommonProxy proxy = new CommonProxy();
public static TechReborn INSTANCE;
public static final ItemGroup ITEMGROUP = new ItemGroup(-1, MOD_ID) {
@ -72,6 +76,16 @@ public class TechReborn {
public TechReborn() {
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
eventBus.addListener(this::setup);
}
private void setup(FMLCommonSetupEvent event) {
// if(!RebornCore.LOADED){
// throw new RuntimeException("RebornCore has not loaded!");
// } else {
// System.out.println("Hello Reborn Core, I see you are loaded and ready.");
// }
MinecraftForge.EVENT_BUS.register(this);
INSTANCE = this;
@ -95,7 +109,8 @@ public class TechReborn {
ModLoot.init();
MinecraftForge.EVENT_BUS.register(new ModLoot());
// Sounds
ModSounds.init();
//TODO 1.13 registry events
//ModSounds.init();
// Client only init, needs to be done before parts system
proxy.init();
// WorldGen

View file

@ -32,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.state.AbstractProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
@ -40,6 +41,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.chunk.BlockStateContainer;
import reborncore.api.ToolManager;
import reborncore.common.blocks.BlockWrenchEventHandler;
import reborncore.common.registration.RebornRegister;
@ -78,7 +80,7 @@ public class BlockCable extends BlockContainer {
public BlockCable(TRContent.Cables type) {
super(Block.Properties.create(Material.ROCK).hardnessAndResistance(1f, 8f));
this.type = type;
setDefaultState(getDefaultState().with(EAST, false).with(WEST, false).with(NORTH, false).with(SOUTH, false).with(UP, false).with(DOWN, false));
setDefaultState(this.stateContainer.getBaseState().with(EAST, false).with(WEST, false).with(NORTH, false).with(SOUTH, false).with(UP, false).with(DOWN, false));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
@ -141,6 +143,11 @@ public class BlockCable extends BlockContainer {
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(EAST, WEST, NORTH, SOUTH, UP, DOWN);
}
/*
@Override
@ -166,11 +173,6 @@ public class BlockCable extends BlockContainer {
return false;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, EAST, WEST, NORTH, SOUTH, UP, DOWN);
}
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
return getStateFromMeta(meta);

View file

@ -26,6 +26,7 @@ package techreborn.blocks.tier1;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
@ -65,7 +66,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
public static PropertyString TYPE;
public BlockPlayerDetector() {
super();
super(Block.Properties.create(Material.IRON), true);
this.setDefaultState(this.stateContainer.getBaseState().with(TYPE, types[0]));
for (int i = 0; i < types.length; i++) {
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, i, "machines/tier1_machines").setInvVariant("type=" + types[i]));

View file

@ -56,29 +56,29 @@ import java.util.Arrays;
*
*/
@Mod.EventBusSubscriber(modid = TechReborn.MOD_ID)
@Mod.EventBusSubscriber(modid = TechReborn.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class RegistryEventHandler {
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties()));
Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties()));
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
Arrays.stream(MachineBlocks.values()).forEach(value -> {
RebornRegistry.registerBlock(value.frame, new Item.Properties());
RebornRegistry.registerBlock(value.casing, new Item.Properties());
RebornRegistry.registerBlock(value.frame, new Item.Properties().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(value.casing, new Item.Properties().group(TechReborn.ITEMGROUP));
});
Arrays.stream(SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties()));
Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties()));
Arrays.stream(Machine.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties()));
Arrays.stream(SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
Arrays.stream(Machine.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Properties().group(TechReborn.ITEMGROUP)));
// Misc. blocks
RebornRegistry.registerBlock(TRContent.COMPUTER_CUBE = InitUtils.setup(new BlockComputerCube(), "computer_cube"), new Item.Properties());
RebornRegistry.registerBlock(TRContent.NUKE = InitUtils.setup(new BlockNuke(), "nuke"), new Item.Properties());
RebornRegistry.registerBlock(TRContent.REFINED_IRON_FENCE = InitUtils.setup(new BlockRefinedIronFence(), "refined_iron_fence"), new Item.Properties());
RebornRegistry.registerBlock(TRContent.REINFORCED_GLASS = InitUtils.setup(new BlockReinforcedGlass(), "reinforced_glass"), new Item.Properties());
RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"), new Item.Properties());
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), new Item.Properties());
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), new Item.Properties());
RebornRegistry.registerBlock(TRContent.COMPUTER_CUBE = InitUtils.setup(new BlockComputerCube(), "computer_cube"), new Item.Properties().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.NUKE = InitUtils.setup(new BlockNuke(), "nuke"), new Item.Properties().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.REFINED_IRON_FENCE = InitUtils.setup(new BlockRefinedIronFence(), "refined_iron_fence"), new Item.Properties().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.REINFORCED_GLASS = InitUtils.setup(new BlockReinforcedGlass(), "reinforced_glass"), new Item.Properties().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"), new Item.Properties().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), new Item.Properties().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), new Item.Properties().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"),
ItemBlockRubberSapling.class,
"rubber_sapling");

View file

@ -24,8 +24,13 @@
package techreborn.init;
import com.mojang.datafixers.DataFixUtils;
import com.mojang.datafixers.types.Type;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.datafix.DataFixesManager;
import net.minecraft.util.datafix.TypeReferences;
import reborncore.common.tile.TileMachineBase;
import techreborn.tiles.*;
import techreborn.tiles.cable.TileCable;
@ -53,6 +58,8 @@ import techreborn.tiles.transformers.TileHVTransformer;
import techreborn.tiles.transformers.TileLVTransformer;
import techreborn.tiles.transformers.TileMVTransformer;
import java.util.function.Supplier;
public class TRTileEntities {
public static final TileEntityType THERMAL_GEN = register(TileThermalGenerator.class, "thermal_generator");
@ -115,7 +122,19 @@ public class TRTileEntities {
public static final TileEntityType FLUID_REPLICATOR = register(TileFluidReplicator.class, "fluid_replicator");
public static <T extends TileEntity> TileEntityType<T> register(Class<T> tClass, String name) {
return null;
return register(new ResourceLocation("techrebonr", name).toString(), TileEntityType.Builder.create(() -> {
//TODO clean this up
try {
return tClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException("Failed to create tile", e);
}
}));
}
public static <T extends TileEntity> TileEntityType<T> register(String id, TileEntityType.Builder<T> builder) {
TileEntityType<T> tileEntityType = builder.build(null);
return tileEntityType;
}
}

View file

@ -1,8 +1,16 @@
modLoader="javafml"
loaderVersion="[13,)"
version="1"
[[mods]]
modId="techreborn"
version="${version}"
displayName="Tech Reborn"
description="Tech Reborn"
[[dependencies.techreborn]]
modId="reborncore"
mandatory=true
ordering="AFTER"
side="BOTH"
versionRange="[4.0.0,)"