Merge branch '1.12' of https://github.com/TechReborn/TechReborn into 1.12-v2.16

This commit is contained in:
Prospector 2018-06-12 15:13:23 -07:00
commit ac9c01555f
32 changed files with 647 additions and 150 deletions

19
.github/CONTRIBUTING.md vendored Normal file
View file

@ -0,0 +1,19 @@
First of all, thank you for you efforts in contributing to TechReborn project
In order to ease code review of your pull request, please, go through this checklist.
* The code compiles )).
* The code has been developer-tested.
* The code includes javadoc where appropriate.
* The code is tidy (indentation, line length, no commented-out code, no spelling mistakes, etc).
* Proper use of exceptions has been considered. It is fine to throw an exception during init.
* Proper side usage (client vs server)
* Logging is used appropriately. Please, do not spam log files
* Unused imports are eliminated.
* Warnings produced by the IDE are eliminated.
* Are there any leftover stubs or test routines in the code?
* Are there any hardcoded, development only things still in the code?
* Was performance considered?
* Corner cases well documented or any workarounds for a known limitation of the MC, Forge, RC, etc used.

View file

@ -85,7 +85,7 @@ configurations {
compile.extendsFrom shade
}
version = "2.15.12"
version = "2.15.15"
def ENV = System.getenv()
if (ENV.BUILD_NUMBER) {

View file

@ -50,6 +50,7 @@ import reborncore.common.multiblock.MultiblockEventHandler;
import reborncore.common.multiblock.MultiblockServerTickHandler;
import reborncore.common.network.RegisterPacketEvent;
import reborncore.common.util.LogHelper;
import reborncore.common.util.Torus;
import techreborn.api.TechRebornAPI;
import techreborn.blocks.cable.EnumCableType;
import techreborn.client.GuiHandler;
@ -65,6 +66,7 @@ import techreborn.init.*;
import techreborn.lib.ModInfo;
import techreborn.packets.*;
import techreborn.proxies.CommonProxy;
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.utils.StackWIPHandler;
import techreborn.world.OilLakeGenerator;
import techreborn.world.TechRebornWorldGen;
@ -172,6 +174,9 @@ public class Core {
if (BehaviorDispenseScrapbox.dispenseScrapboxes) {
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.SCRAP_BOX, new BehaviorDispenseScrapbox());
}
Torus.genSizeMap(TileFusionControlComputer.maxCoilSize);
logHelper.info("Initialization Complete");
}

View file

@ -31,7 +31,6 @@ import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
@ -42,9 +41,11 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.common.powerSystem.PoweredItem;
import reborncore.common.util.WorldUtils;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
import techreborn.init.ModSounds;
@ -94,7 +95,6 @@ public class BlockRubberLog extends Block {
return this.getDefaultState().withProperty(SAP_SIDE, facing).withProperty(HAS_SAP, hasSap);
}
@SuppressWarnings({ "incomplete-switch" })
@Override
public int getMetaFromState(IBlockState state) {
int tempMeta = 0;
@ -111,6 +111,12 @@ public class BlockRubberLog extends Block {
break;
case EAST:
tempMeta = 3;
break;
case UP:
tempMeta = 0;
break;
case DOWN:
tempMeta = 0;
}
if (state.getValue(HAS_SAP)) {
tempMeta += 4;
@ -158,42 +164,38 @@ public class BlockRubberLog extends Block {
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
if (!stack.isEmpty())
if ((stack.getItem() instanceof ItemElectricTreetap && PoweredItem.canUseEnergy(20, stack)) || stack.getItem() instanceof ItemTreeTap)
if (state.getValue(HAS_SAP)) {
if (state.getValue(SAP_SIDE) == side) {
worldIn.setBlockState(pos,
state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
worldIn.playSound(null, pos.getX(), pos.getY(),
pos.getZ(), ModSounds.SAP_EXTRACT,
SoundCategory.BLOCKS, 0.6F, 1F);
if (!worldIn.isRemote) {
if (stack.getItem() instanceof ItemElectricTreetap) {
PoweredItem.useEnergy(20, stack);
} else {
playerIn.getHeldItem(EnumHand.MAIN_HAND).damageItem(1, playerIn);
}
if (!playerIn.inventory.addItemStackToInventory(ItemParts.getPartByName("rubberSap").copy())) {
Random rand = new Random();
BlockPos itemPos = pos.offset(side);
EntityItem item = new EntityItem(worldIn, itemPos.getX(), itemPos.getY(), itemPos.getZ(),
ItemParts.getPartByName("rubberSap").copy());
float factor = 0.05F;
item.motionX = rand.nextGaussian() * factor;
item.motionY = rand.nextGaussian() * factor + 0.2F;
item.motionZ = rand.nextGaussian() * factor;
worldIn.spawnEntity(item);
}
if (playerIn instanceof EntityPlayerMP) {
TRRecipeHandler.unlockTRRecipes((EntityPlayerMP) playerIn);
}
}
return true;
if (stack.isEmpty()) {
return false;
}
IEnergyStorage capEnergy = null;
if (stack.getItem() instanceof ItemElectricTreetap) {
capEnergy = stack.getCapability(CapabilityEnergy.ENERGY, null);
}
if ((capEnergy != null && capEnergy.getEnergyStored() > 20) || stack.getItem() instanceof ItemTreeTap) {
if (state.getValue(HAS_SAP) && state.getValue(SAP_SIDE) == side) {
worldIn.setBlockState(pos,
state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS,
0.6F, 1F);
if (!worldIn.isRemote) {
if (capEnergy != null) {
capEnergy.extractEnergy(20, false);
} else {
playerIn.getHeldItem(EnumHand.MAIN_HAND).damageItem(1, playerIn);
}
if (!playerIn.inventory.addItemStackToInventory(ItemParts.getPartByName("rubberSap").copy())) {
WorldUtils.dropItem(ItemParts.getPartByName("rubberSap").copy(), worldIn, pos.offset(side));
}
if (playerIn instanceof EntityPlayerMP) {
TRRecipeHandler.unlockTRRecipes((EntityPlayerMP) playerIn);
}
}
return true;
}
}
return false;
}

View file

@ -0,0 +1,161 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo;
import java.util.Random;
//Thanks @Prospector you saved me me some time :)
public abstract class BlockRubberPlankSlab extends BlockSlab {
public static final PropertyEnum<Variant> VARIANT = PropertyEnum.create("variant", BlockRubberPlankSlab.Variant.class);
public final String name;
public Block halfslab;
public BlockRubberPlankSlab(String name) {
super(Material.WOOD, Material.WOOD.getMaterialMapColor());
this.name = name;
IBlockState iblockstate = this.blockState.getBaseState();
if (!this.isDouble()) {
iblockstate = iblockstate.withProperty(HALF, EnumBlockHalf.BOTTOM);
halfslab = this;
}
setCreativeTab(TechRebornCreativeTabMisc.instance);
setHarvestLevel("axe", 0);
setHardness(2.0F);
setResistance(15);
setSoundType(SoundType.WOOD);
this.setDefaultState(iblockstate.withProperty(VARIANT, BlockRubberPlankSlab.Variant.DEFAULT));
useNeighborBrightness = true;
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this));
}
@Override
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
return true;
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(halfslab);
}
@Override
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
return new ItemStack(halfslab);
}
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockRubberPlankSlab.Variant.DEFAULT);
if (!this.isDouble()) {
iblockstate = iblockstate.withProperty(HALF, (meta & 8) == 0 ? EnumBlockHalf.BOTTOM : EnumBlockHalf.TOP);
}
return iblockstate;
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if (!this.isDouble() && state.getValue(HALF) == EnumBlockHalf.TOP) {
i |= 8;
}
return i;
}
@Override
protected BlockStateContainer createBlockState() {
return this.isDouble() ? new BlockStateContainer(this, new IProperty[] { VARIANT }) : new BlockStateContainer(this, new IProperty[] { HALF, VARIANT });
}
@Override
public String getUnlocalizedName(int meta) {
return super.getUnlocalizedName();
}
@Override
public IProperty<?> getVariantProperty() {
return VARIANT;
}
@Override
public Comparable<?> getTypeForItem(ItemStack stack) {
return BlockRubberPlankSlab.Variant.DEFAULT;
}
public static enum Variant implements IStringSerializable {
DEFAULT;
@Override
public String getName() {
return "default";
}
}
public static class BlockDouble extends BlockRubberPlankSlab {
public BlockDouble(String name, Block half) {
super(name);
this.halfslab = half;
}
@Override
public boolean isDouble() {
return true;
}
}
public static class BlockHalf extends BlockRubberPlankSlab {
public BlockHalf(String name) {
super(name);
}
@Override
public boolean isDouble() {
return false;
}
}
}

View file

@ -0,0 +1,42 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.blocks;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.state.IBlockState;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo;
public class BlockRubberPlankStair extends BlockStairs {
public BlockRubberPlankStair(IBlockState modelState, String name) {
super(modelState);
setCreativeTab(TechRebornCreativeTabMisc.instance);
useNeighborBrightness = true;
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this));
}
}

View file

@ -55,7 +55,7 @@ public class GuiBase extends GuiContainer {
public BuiltContainer container;
public static boolean showSlotConfig = false;
private boolean upgrades;
public boolean upgrades;
public GuiBase(EntityPlayer player, TileEntity tile, BuiltContainer container) {
super(container);

View file

@ -28,6 +28,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.tuple.Pair;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
import reborncore.client.multiblock.MultiblockSet;
@ -43,6 +44,7 @@ import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import java.awt.*;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
public class GuiFusionReactor extends GuiBase {
TileFusionControlComputer tile;
@ -89,6 +91,16 @@ public class GuiFusionReactor extends GuiBase {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
Optional<Pair<Integer, Integer>> stackSize = getCoilStackCount();
if(stackSize.isPresent()){
if(stackSize.get().getLeft() > 0){
drawCentredString("Required Coils: " + stackSize.get().getLeft() + "x64 +" + stackSize.get().getRight(), 25, 0xFFFFFF, layer);
} else {
drawCentredString("Required Coils: " + stackSize.get().getRight(), 25, 0xFFFFFF, layer);
}
}
}
this.builder.drawUpDownButtons(this, 121, 79, layer);
drawString("Size: " + tile.size, 83, 81, 0xFFFFFF, layer);
@ -158,4 +170,12 @@ public class GuiFusionReactor extends GuiBase {
public void addComponent(final int x, final int y, final int z, final IBlockState blockState, final Multiblock multiblock) {
multiblock.addComponent(new BlockPos(x, y, z), blockState);
}
public Optional<Pair<Integer, Integer>> getCoilStackCount(){
if(!Torus.TORUS_SIZE_MAP.containsKey(tile.size)){
return Optional.empty();
}
int count = Torus.TORUS_SIZE_MAP.get(tile.size);
return Optional.of(Pair.of(count / 64, count % 64));
}
}

View file

@ -24,14 +24,13 @@
package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import techreborn.tiles.tier0.TileIronFurnace;
public class GuiIronFurnace extends GuiContainer {
public class GuiIronFurnace extends GuiBase {
public static final ResourceLocation texture = new ResourceLocation("minecraft",
"textures/gui/container/furnace.png");
@ -39,7 +38,7 @@ public class GuiIronFurnace extends GuiContainer {
TileIronFurnace furnace;
public GuiIronFurnace(final EntityPlayer player, final TileIronFurnace furnace) {
super(furnace.createContainer(player));
super(player, furnace, furnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.furnace = furnace;
@ -49,6 +48,7 @@ public class GuiIronFurnace extends GuiContainer {
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
this.drawDefaultBackground();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
builder.drawSlotTab(this, guiLeft, guiTop, p_146976_2_, p_146976_3_, upgrades);
this.mc.getTextureManager().bindTexture(GuiIronFurnace.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
@ -74,6 +74,8 @@ public class GuiIronFurnace extends GuiContainer {
4210752);
this.fontRenderer.drawString(I18n.format("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
super.drawGuiContainerForegroundLayer(p_146979_1_, p_146979_2_);
}
@Override

View file

@ -25,6 +25,7 @@
package techreborn.client.gui.slot.elements;
public class ButtonElement extends ElementBase {
@SuppressWarnings("unused")
private Sprite.Button buttonSprite;
public ButtonElement(int x, int y, Sprite.Button buttonSprite) {

View file

@ -83,7 +83,8 @@ public class StackToolTipEvent {
Block block = Block.getBlockFromItem(item);
if (block != null && (block instanceof BlockContainer || block instanceof ITileEntityProvider)
&& block.getRegistryName().getResourceDomain().contains("techreborn")) {
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().world, block.getDefaultState());
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().world,
block.getStateFromMeta(event.getItemStack().getItemDamage()));
if (tile instanceof IListInfoProvider) {
((IListInfoProvider) tile).addInfo(event.getToolTip(), false);
}

View file

@ -25,8 +25,10 @@
package techreborn.init;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.oredict.OreDictionary;
@ -120,6 +122,9 @@ public class ModBlocks {
public static Block NUKE;
public static Block RUBBER_LOG;
public static Block RUBBER_LOG_SLAB_HALF;
public static Block RUBBER_LOG_SLAB_DOUBLE;
public static Block RUBBER_LOG_STAIR;
public static Block RUBBER_LEAVES;
public static Block RUBBER_SAPLING;
public static Block RUBBER_PLANKS;
@ -296,6 +301,15 @@ public class ModBlocks {
RUBBER_PLANKS = new BlockRubberPlank();
registerBlock(RUBBER_PLANKS, "rubber_planks");
RUBBER_LOG_SLAB_HALF = new BlockRubberPlankSlab.BlockHalf("rubber_plank");
registerBlockNoItem(RUBBER_LOG_SLAB_HALF, "rubber_plank_slab");
RUBBER_LOG_SLAB_DOUBLE = new BlockRubberPlankSlab.BlockDouble("rubber_plank", RUBBER_LOG_SLAB_HALF);
registerBlock(RUBBER_LOG_SLAB_DOUBLE, new ItemSlab(RUBBER_LOG_SLAB_HALF, (BlockSlab) RUBBER_LOG_SLAB_HALF, (BlockSlab) RUBBER_LOG_SLAB_DOUBLE) , "rubber_plank_double_slab");
RUBBER_LOG_STAIR = new BlockRubberPlankStair(RUBBER_LOG.getDefaultState(), "rubber_plank");
registerBlock(RUBBER_LOG_STAIR, "rubber_plank_stair");
RUBBER_LEAVES = new BlockRubberLeaves();
registerBlock(RUBBER_LEAVES, "rubber_leaves");
@ -395,6 +409,18 @@ public class ModBlocks {
RebornRegistry.registerBlock(block, itemclass, new ResourceLocation(ModInfo.MOD_ID, name));
}
public static void registerBlock(Block block, ItemBlock itemBlock, String name) {
name = name.toLowerCase();
block.setUnlocalizedName(ModInfo.MOD_ID + ":" + name);
RebornRegistry.registerBlock(block, itemBlock, new ResourceLocation(ModInfo.MOD_ID, name));
}
public static void registerBlockNoItem(Block block, String name) {
name = name.toLowerCase();
block.setUnlocalizedName(ModInfo.MOD_ID + ":" + name);
RebornRegistry.registerBlockNoItem(block, new ResourceLocation(ModInfo.MOD_ID, name));
}
/**
* Register ores and ore blocks
*/
@ -442,6 +468,8 @@ public class ModBlocks {
OreUtil.registerOre("logWood", new ItemStack(RUBBER_LOG, 1, OreDictionary.WILDCARD_VALUE));
OreUtil.registerOre("logRubber", new ItemStack(RUBBER_LOG, 1, OreDictionary.WILDCARD_VALUE));
OreUtil.registerOre("plankWood", new ItemStack(RUBBER_PLANKS, 1, OreDictionary.WILDCARD_VALUE));
OreUtil.registerOre("slabWood", new ItemStack(RUBBER_LOG_SLAB_HALF, 1, OreDictionary.WILDCARD_VALUE));
OreUtil.registerOre("stairWood", new ItemStack(RUBBER_LOG_STAIR, 1, OreDictionary.WILDCARD_VALUE));
OreUtil.registerOre("plankRubber", new ItemStack(RUBBER_PLANKS, 1, OreDictionary.WILDCARD_VALUE));
OreUtil.registerOre("treeLeaves", new ItemStack(RUBBER_LEAVES, 1, OreDictionary.WILDCARD_VALUE));
OreUtil.registerOre("leavesRubber", new ItemStack(RUBBER_LEAVES, 1, OreDictionary.WILDCARD_VALUE));

View file

@ -227,84 +227,84 @@ public class ModItems {
registerItem(ADVANCED_JACKHAMMER, "ironjackhammer");
if (ConfigTechReborn.enableGemArmorAndTools) {
BRONZE_SWORD = new ItemTRSword(Reference.BRONZE);
BRONZE_SWORD = new ItemTRSword(Reference.BRONZE, "ingotBronze");
registerItem(BRONZE_SWORD, "bronzeSword");
BRONZE_PICKAXE = new ItemTRPickaxe(Reference.BRONZE);
BRONZE_PICKAXE = new ItemTRPickaxe(Reference.BRONZE, "ingotBronze");
registerItem(BRONZE_PICKAXE, "bronzePickaxe");
BRONZE_SPADE = new ItemTRSpade(Reference.BRONZE);
BRONZE_SPADE = new ItemTRSpade(Reference.BRONZE, "ingotBronze");
registerItem(BRONZE_SPADE, "bronzeSpade");
BRONZE_AXE = new ItemTRAxe(Reference.BRONZE);
BRONZE_AXE = new ItemTRAxe(Reference.BRONZE, "ingotBronze");
registerItem(BRONZE_AXE, "bronzeAxe");
BRONZE_HOE = new ItemTRHoe(Reference.BRONZE);
BRONZE_HOE = new ItemTRHoe(Reference.BRONZE, "ingotBronze");
registerItem(BRONZE_HOE, "bronzeHoe");
BRONZE_HELMET = new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.HEAD);
BRONZE_HELMET = new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.HEAD, "ingotBronze");
registerItem(BRONZE_HELMET, "bronzeHelmet");
BRONZE_CHESTPLATE = new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.CHEST);
BRONZE_CHESTPLATE = new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.CHEST, "ingotBronze");
registerItem(BRONZE_CHESTPLATE, "bronzeChestplate");
BRONZE_LEGGINGS = new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.LEGS);
BRONZE_LEGGINGS = new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.LEGS, "ingotBronze");
registerItem(BRONZE_LEGGINGS, "bronzeLeggings");
BRONZE_BOOTS = new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.FEET);
BRONZE_BOOTS = new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.FEET, "ingotBronze");
registerItem(BRONZE_BOOTS, "bronzeBoots");
RUBY_SWORD = new ItemTRSword(Reference.RUBY);
RUBY_SWORD = new ItemTRSword(Reference.RUBY, "gemRuby");
registerItem(RUBY_SWORD, "rubySword");
RUBY_PICKAXE = new ItemTRPickaxe(Reference.RUBY);
RUBY_PICKAXE = new ItemTRPickaxe(Reference.RUBY, "gemRuby");
registerItem(RUBY_PICKAXE, "rubyPickaxe");
RUBY_SPADE = new ItemTRSpade(Reference.RUBY);
RUBY_SPADE = new ItemTRSpade(Reference.RUBY, "gemRuby");
registerItem(RUBY_SPADE, "rubySpade");
RUBY_AXE = new ItemTRAxe(Reference.RUBY);
RUBY_AXE = new ItemTRAxe(Reference.RUBY, "gemRuby");
registerItem(RUBY_AXE, "rubyAxe");
RUBY_HOE = new ItemTRHoe(Reference.RUBY);
RUBY_HOE = new ItemTRHoe(Reference.RUBY, "gemRuby");
registerItem(RUBY_HOE, "rubyHoe");
RUBY_HELMET = new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.HEAD);
RUBY_HELMET = new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.HEAD, "gemRuby");
registerItem(RUBY_HELMET, "rubyHelmet");
RUBY_CHESTPLATE = new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.CHEST);
RUBY_CHESTPLATE = new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.CHEST, "gemRuby");
registerItem(RUBY_CHESTPLATE, "rubyChestplate");
RUBY_LEGGINGS = new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.LEGS);
RUBY_LEGGINGS = new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.LEGS, "gemRuby");
registerItem(RUBY_LEGGINGS, "rubyLeggings");
RUBY_BOOTS = new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.FEET);
RUBY_BOOTS = new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.FEET, "gemRuby");
registerItem(RUBY_BOOTS, "rubyBoots");
SAPPHIRE_SWORD = new ItemTRSword(Reference.SAPPHIRE);
SAPPHIRE_SWORD = new ItemTRSword(Reference.SAPPHIRE, "gemSapphire");
registerItem(SAPPHIRE_SWORD, "sapphireSword");
SAPPHIRE_PICKAXE = new ItemTRPickaxe(Reference.SAPPHIRE);
SAPPHIRE_PICKAXE = new ItemTRPickaxe(Reference.SAPPHIRE, "gemSapphire");
registerItem(SAPPHIRE_PICKAXE, "sapphirePickaxe");
SAPPHIRE_SPADE = new ItemTRSpade(Reference.SAPPHIRE);
SAPPHIRE_SPADE = new ItemTRSpade(Reference.SAPPHIRE, "gemSapphire");
registerItem(SAPPHIRE_SPADE, "sapphireSpade");
SAPPHIRE_AXE = new ItemTRAxe(Reference.SAPPHIRE);
SAPPHIRE_AXE = new ItemTRAxe(Reference.SAPPHIRE, "gemSapphire");
registerItem(SAPPHIRE_AXE, "sapphireAxe");
SAPPHIRE_HOE = new ItemTRHoe(Reference.SAPPHIRE);
SAPPHIRE_HOE = new ItemTRHoe(Reference.SAPPHIRE, "gemSapphire");
registerItem(SAPPHIRE_HOE, "sapphireHoe");
SAPPHIRE_HELMET = new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.HEAD);
SAPPHIRE_HELMET = new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.HEAD, "gemSapphire");
registerItem(SAPPHIRE_HELMET, "sapphireHelmet");
SAPPHIRE_CHSTPLATE = new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.CHEST);
SAPPHIRE_CHSTPLATE = new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.CHEST, "gemSapphire");
registerItem(SAPPHIRE_CHSTPLATE, "sapphireChestplate");
SAPPHIRE_LEGGINGS = new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.LEGS);
SAPPHIRE_LEGGINGS = new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.LEGS, "gemSapphire");
registerItem(SAPPHIRE_LEGGINGS, "sapphireLeggings");
SAPPHIRE_BOOTS = new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.FEET);
SAPPHIRE_BOOTS = new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.FEET, "gemSapphire");
registerItem(SAPPHIRE_BOOTS, "sapphireBoots");
PERIDOT_SWORD = new ItemTRSword(Reference.PERIDOT);
PERIDOT_SWORD = new ItemTRSword(Reference.PERIDOT, "gemPeridot");
registerItem(PERIDOT_SWORD, "peridotSword");
PERIDOT_PICKAXE = new ItemTRPickaxe(Reference.PERIDOT);
PERIDOT_PICKAXE = new ItemTRPickaxe(Reference.PERIDOT, "gemPeridot");
registerItem(PERIDOT_PICKAXE, "peridotPickaxe");
PERIDOT_SAPPHIRE = new ItemTRSpade(Reference.PERIDOT);
PERIDOT_SAPPHIRE = new ItemTRSpade(Reference.PERIDOT, "gemPeridot");
registerItem(PERIDOT_SAPPHIRE, "peridotSpade");
PERIDOT_AXE = new ItemTRAxe(Reference.PERIDOT);
PERIDOT_AXE = new ItemTRAxe(Reference.PERIDOT, "gemPeridot");
registerItem(PERIDOT_AXE, "peridotAxe");
PERIDOT_HOE = new ItemTRHoe(Reference.PERIDOT);
PERIDOT_HOE = new ItemTRHoe(Reference.PERIDOT, "gemPeridot");
registerItem(PERIDOT_HOE, "peridotHoe");
PERIDOT_HELMET = new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.HEAD);
PERIDOT_HELMET = new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.HEAD, "gemPeridot");
registerItem(PERIDOT_HELMET, "peridotHelmet");
PERIDOT_CHESTPLATE = new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.CHEST);
PERIDOT_CHESTPLATE = new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.CHEST, "gemPeridot");
registerItem(PERIDOT_CHESTPLATE, "peridotChestplate");
PERIDOT_LEGGINGS = new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.LEGS);
PERIDOT_LEGGINGS = new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.LEGS, "gemPeridot");
registerItem(PERIDOT_LEGGINGS, "peridotLeggings");
PERIDOT_BOOTS = new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.FEET);
PERIDOT_BOOTS = new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.FEET, "gemPeridot");
registerItem(PERIDOT_BOOTS, "peridotBoots");
}

View file

@ -285,6 +285,9 @@ public class CraftingTableRecipes extends RecipeMethods {
}
}
registerShaped(new ItemStack(ModBlocks.RUBBER_LOG_SLAB_HALF), "WWW", 'W', new ItemStack(ModBlocks.RUBBER_PLANKS));
registerShaped(new ItemStack(ModBlocks.RUBBER_LOG_STAIR), "W ", "WW ", "WWW", 'W', new ItemStack(ModBlocks.RUBBER_PLANKS));
Core.logHelper.info("Crafting Table Recipes Added");
}

View file

@ -31,7 +31,6 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
@ -45,6 +44,9 @@ import techreborn.lib.ModInfo;
import javax.annotation.Nonnull;
import java.security.InvalidParameterException;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class IndustrialSawmillRecipes extends RecipeMethods {
@ -68,7 +70,11 @@ public class IndustrialSawmillRecipes extends RecipeMethods {
}, 1, 1);
inventoryCrafting.setInventorySlotContents(0, ItemStack.EMPTY);
NonNullList<ItemStack> logs = OreDictionary.getOres("logWood");
List<ItemStack> logs = OreDictionary.getOres("logWood").stream()
.filter(Objects::nonNull)
.map(ItemStack::copy)
.collect(Collectors.toList());
for (ItemStack logStack : logs) {
if (logStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && logStack.getHasSubtypes()) {
for (int i = 0; i < 16; i++) {

View file

@ -26,6 +26,8 @@ package techreborn.items.armor;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import reborncore.common.util.ItemUtils;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
@ -34,8 +36,15 @@ import techreborn.events.TRRecipeHandler;
*/
public class ItemTRArmour extends ItemArmor {
String repairOreDict = "";
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot) {
this(material, slot, "");
}
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot, String repairOreDict) {
super(material, material.getDamageReductionAmount(slot), slot);
this.repairOreDict = repairOreDict;
if (slot == EntityEquipmentSlot.HEAD)
setUnlocalizedName(material.name().toLowerCase() + "Helmet");
if (slot == EntityEquipmentSlot.CHEST)
@ -47,4 +56,12 @@ public class ItemTRArmour extends ItemArmor {
setCreativeTab(TechRebornCreativeTabMisc.instance);
TRRecipeHandler.hideEntry(this);
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
}
return super.getIsRepairable(toRepair, repair);
}
}

View file

@ -25,14 +25,32 @@
package techreborn.items.tools;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import reborncore.common.util.ItemUtils;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRAxe extends ItemAxe {
String repairOreDict = "";
public ItemTRAxe(ToolMaterial material) {
this(material, "");
}
public ItemTRAxe(ToolMaterial material, String repairOreDict) {
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F);
this.repairOreDict = repairOreDict;
setUnlocalizedName(material.name().toLowerCase() + "Axe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
TRRecipeHandler.hideEntry(this);
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
}
return super.getIsRepairable(toRepair, repair);
}
}

View file

@ -25,14 +25,24 @@
package techreborn.items.tools;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.util.ItemUtils;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRHoe extends ItemHoe {
String repairOreDict = "";
public ItemTRHoe(ToolMaterial material) {
this(material, "");
}
public ItemTRHoe(ToolMaterial material, String repairOreDict) {
super(material);
this.repairOreDict = repairOreDict;
setUnlocalizedName(material.name().toLowerCase() + "Hoe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
TRRecipeHandler.hideEntry(this);
@ -43,4 +53,12 @@ public class ItemTRHoe extends ItemHoe {
public boolean isFull3D() {
return true;
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
}
return super.getIsRepairable(toRepair, repair);
}
}

View file

@ -25,14 +25,33 @@
package techreborn.items.tools;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import reborncore.common.util.ItemUtils;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRPickaxe extends ItemPickaxe {
String repairOreDict = "";
public ItemTRPickaxe(ToolMaterial material) {
this(material, "");
}
public ItemTRPickaxe(ToolMaterial material, String repairOreDict) {
super(material);
this.repairOreDict = repairOreDict;
setUnlocalizedName(material.name().toLowerCase() + "Pickaxe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
TRRecipeHandler.hideEntry(this);
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
return ItemUtils.isInputEqual(repairOreDict, repair, true, false, true);
}
return super.getIsRepairable(toRepair, repair);
}
}

View file

@ -25,14 +25,32 @@
package techreborn.items.tools;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import reborncore.common.util.ItemUtils;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRSpade extends ItemSpade {
String repairOreDict = "";
public ItemTRSpade(ToolMaterial material) {
this(material, "");
}
public ItemTRSpade(ToolMaterial material, String repairOreDict) {
super(material);
this.repairOreDict = repairOreDict;
setUnlocalizedName(material.name().toLowerCase() + "Spade");
setCreativeTab(TechRebornCreativeTabMisc.instance);
TRRecipeHandler.hideEntry(this);
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
}
return super.getIsRepairable(toRepair, repair);
}
}

View file

@ -24,15 +24,33 @@
package techreborn.items.tools;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import reborncore.common.util.ItemUtils;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRSword extends ItemSword {
String repairOreDict = "";
public ItemTRSword(ToolMaterial material) {
this(material, "");
}
public ItemTRSword(ToolMaterial material, String repairOreDict) {
super(material);
this.repairOreDict = repairOreDict;
setUnlocalizedName(material.name().toLowerCase() + "Sword");
setCreativeTab(TechRebornCreativeTabMisc.instance);
TRRecipeHandler.hideEntry(this);
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
}
return super.getIsRepairable(toRepair, repair);
}
}

View file

@ -24,13 +24,16 @@
package techreborn.tiles;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import reborncore.common.util.ChatUtils;
import techreborn.blocks.BlockAlarm;
import techreborn.init.ModSounds;
@ -87,4 +90,9 @@ public class TileAlarm extends TileEntity implements ITickable {
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponentString(TextFormatting.GRAY + I18n.format("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
}
}
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) {
return false;
}
}

View file

@ -53,6 +53,7 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
private int transferRate = 0;
private EnumCableType cableType = null;
private ArrayList<EnumFacing> sendingFace = new ArrayList<EnumFacing>();
int ticksSinceLastChange = 0;
private EnumCableType getCableType() {
return world.getBlockState(pos).getValue(BlockCable.TYPE);
@ -62,7 +63,7 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
if (sendingFace.contains(face)) {
return false;
}
return true;
return canReceive();
}
// TileEntity
@ -74,7 +75,6 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if (capability == CapabilityEnergy.ENERGY) {
@ -85,19 +85,11 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
@Override
public NBTTagCompound getUpdateTag() {
// getUpdateTag() is called whenever the chunkdata is sent to the
// client. In contrast getUpdatePacket() is called when the tile entity
// itself wants to sync to the client. In many cases you want to send
// over the same information in getUpdateTag() as in getUpdatePacket().
return writeToNBT(new NBTTagCompound());
}
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
// Prepare a packet for syncing our TE to the client. Since we only have to sync the stack
// and that's all we have we just write our entire NBT here. If you have a complex
// tile entity that doesn't need to have all information on the client you can write
// a more optimal NBT here.
NBTTagCompound nbtTag = new NBTTagCompound();
this.writeToNBT(nbtTag);
return new SPacketUpdateTileEntity(getPos(), 1, nbtTag);
@ -105,7 +97,6 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
// Here we get the packet from the server and read it into our client side tile entity
this.readFromNBT(packet.getNbtCompound());
}
@ -140,10 +131,17 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
this.transferRate = this.cableType.transferRate * RebornCoreConfig.euPerFU;
}
ArrayList<IEnergyStorage> acceptors = new ArrayList<IEnergyStorage>();
ArrayList<TileCable> cables = new ArrayList<TileCable>();
sendingFace.clear();
ticksSinceLastChange++;
if (ticksSinceLastChange >= 10) {
sendingFace.clear();
ticksSinceLastChange = 0;
}
if (!canExtract()) {
return;
}
ArrayList<IEnergyStorage> acceptors = new ArrayList<IEnergyStorage>();
for (EnumFacing face : EnumFacing.VALUES) {
TileEntity tile = world.getTileEntity(pos.offset(face));
@ -152,48 +150,26 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
} else if (tile instanceof TileCable) {
TileCable cable = (TileCable) tile;
if (power > cable.power && cable.canReceiveFromFace(face.getOpposite())) {
cables.add(cable);
sendingFace.add(face);
acceptors.add((IEnergyStorage) tile);
if (!sendingFace.contains(face)) {
sendingFace.add(face);
}
}
} else if (tile.hasCapability(CapabilityEnergy.ENERGY, face.getOpposite())) {
IEnergyStorage energyTile = tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite());
if (energyTile != null && energyTile.canReceive()){
if (energyTile != null && energyTile.canReceive()) {
acceptors.add(energyTile);
}
}
}
if (cables.size() > 0){
int drain = Math.min(power, transferRate);
int energyShare = drain / cables.size();
int remainingEnergy = drain;
if (energyShare > 0) {
for (TileCable cable : cables) {
// Push energy to connected cables
int move = cable.receiveEnergy(Math.min(energyShare, remainingEnergy), false);
if (move > 0) {
remainingEnergy -= move;
}
if (acceptors.size() > 0 ) {
for (IEnergyStorage tile : acceptors) {
int drain = Math.min(power, transferRate);
if (drain > 0 && tile.receiveEnergy(drain, true) > 0) {
int move = tile.receiveEnergy(drain, false);
extractEnergy(move, false);
}
extractEnergy(drain - remainingEnergy, false);
}
}
if (acceptors.size() > 0){
int drain = Math.min(power, transferRate);
int energyShare = drain / acceptors.size();
int remainingEnergy = drain;
if (energyShare > 0) {
for (IEnergyStorage tile : acceptors){
// Push energy to connected tile acceptors
int move = tile.receiveEnergy(Math.min(energyShare, remainingEnergy), false);
if (move > 0) {
remainingEnergy -= move;
}
}
extractEnergy(drain - remainingEnergy, false);
}
}
}
@ -230,7 +206,7 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
@Override
public int getMaxEnergyStored() {
return this.transferRate * 6;
return this.transferRate * 5;
}
@Override

View file

@ -151,7 +151,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
* @return int Scale of progress
*/
public int getProgressScaled(int scale) {
if (this.crafingTickTime != 0) {
if (this.crafingTickTime != 0 && this.finalTickTime != 0) {
return this.crafingTickTime * scale / this.finalTickTime;
}
return 0;
@ -180,9 +180,13 @@ public class TileFusionControlComputer extends TilePowerAcceptor
* @return boolean True if reactor can execute recipe provided
*/
private boolean validateReactorRecipe(FusionReactorRecipe recipe) {
if (ItemUtils.isItemEqual(this.getStackInSlot(topStackSlot), recipe.getTopInput(), true, true, true)) {
return validateReactorRecipeInputs(recipe, getStackInSlot(topStackSlot), getStackInSlot(bottomStackSlot)) || validateReactorRecipeInputs(recipe, getStackInSlot(bottomStackSlot), getStackInSlot(topStackSlot));
}
private boolean validateReactorRecipeInputs(FusionReactorRecipe recipe, ItemStack slot1, ItemStack slot2) {
if (ItemUtils.isItemEqual(slot1, recipe.getTopInput(), true, true, true)) {
if (recipe.getBottomInput() != null) {
if (!ItemUtils.isItemEqual(this.getStackInSlot(bottomStackSlot), recipe.getBottomInput(), true, true, true)) {
if (!ItemUtils.isItemEqual(slot2, recipe.getBottomInput(), true, true, true)) {
return false;
}
}
@ -218,7 +222,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
}
if (this.currentRecipe != null) {
if (this.inventory.hasChanged && !validateReactorRecipe(this.currentRecipe)) {
if (!hasStartedCrafting && this.inventory.hasChanged && !validateReactorRecipe(this.currentRecipe)) {
resetCrafter();
return;
}
@ -228,6 +232,10 @@ public class TileFusionControlComputer extends TilePowerAcceptor
if (this.canUseEnergy(this.currentRecipe.getStartEU())) {
this.useEnergy(this.currentRecipe.getStartEU());
this.hasStartedCrafting = true;
this.decrStackSize(this.topStackSlot, this.currentRecipe.getTopInput().getCount());
if (!this.currentRecipe.getBottomInput().isEmpty()) {
this.decrStackSize(this.bottomStackSlot, this.currentRecipe.getBottomInput().getCount());
}
}
}
if (hasStartedCrafting && this.crafingTickTime < this.finalTickTime) {
@ -249,10 +257,6 @@ public class TileFusionControlComputer extends TilePowerAcceptor
} else {
this.decrStackSize(this.outputStackSlot, -this.currentRecipe.getOutput().getCount());
}
this.decrStackSize(this.topStackSlot, this.currentRecipe.getTopInput().getCount());
if (!this.currentRecipe.getBottomInput().isEmpty()) {
this.decrStackSize(this.bottomStackSlot, this.currentRecipe.getBottomInput().getCount());
}
if (this.validateReactorRecipe(this.currentRecipe)) {
this.crafingTickTime = 0;
} else {
@ -271,7 +275,8 @@ public class TileFusionControlComputer extends TilePowerAcceptor
@Override
public double getPowerMultiplier() {
return size -5;
double calc = (1F/2F) * Math.pow(size -5, 1.8);
return Math.max(Math.round(calc * 100D) / 100D, 1D);
}
@Override

View file

@ -49,6 +49,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
@ -247,6 +248,9 @@ public class TechRebornWorldGen implements IWorldGenerator {
int chance = config.rubberTreeConfig.chance;
boolean isValidSpawn = false;
Biome biomeGenBase = world.getBiomeForCoordsBody(new BlockPos(chunkX * 16, 72, chunkZ * 16));
if(biomeGenBase.getRegistryName() != null && Arrays.asList(config.rubberTreeConfig.rubberTreeBiomeBlacklist).contains(biomeGenBase.getRegistryName().toString())){
return;
}
if (BiomeDictionary.hasType(biomeGenBase, BiomeDictionary.Type.SWAMP)) {
// TODO check the config file for bounds on this, might cause issues
chance -= random.nextInt(10) + 10;

View file

@ -41,4 +41,6 @@ public class RubberTreeConfig {
public int spireHeight = 4;
public int treeBaseHeight = 5;
public String[] rubberTreeBiomeBlacklist = new String[]{};
}

View file

@ -0,0 +1,24 @@
{
"forge_marker": 1,
"defaults": {
"model": "cube_all",
"textures": {
"all": "techreborn:blocks/rubber_planks"
}
},
"variants": {
"inventory": {
"transform": "forge:default-block",
"model": "half_slab",
"textures": {
"top": "techreborn:blocks/rubber_planks",
"bottom": "techreborn:blocks/rubber_planks",
"side": "techreborn:blocks/rubber_planks"
}
},
"variant": {
"default": {}
}
}
}

View file

@ -0,0 +1,21 @@
{
"forge_marker": 1,
"defaults": {
"model": "half_slab",
"textures": {
"top": "techreborn:blocks/rubber_planks",
"bottom": "techreborn:blocks/rubber_planks",
"side": "techreborn:blocks/rubber_planks"
}
},
"variants": {
"inventory": { "transform": "forge:default-block" },
"half": {
"top": { "model": "upper_slab" },
"bottom": { "model": "half_slab" }
},
"variant": {
"default": {}
}
}
}

View file

@ -0,0 +1,53 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"bottom": "techreborn:blocks/rubber_planks",
"top": "techreborn:blocks/rubber_planks",
"side": "techreborn:blocks/rubber_planks"
}
},
"variants": {
"facing=east,half=bottom,shape=straight": { "model": "minecraft:stairs" },
"facing=west,half=bottom,shape=straight": { "model": "minecraft:stairs", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=straight": { "model": "minecraft:stairs", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=straight": { "model": "minecraft:stairs", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=outer_right": { "model": "minecraft:outer_stairs" },
"facing=west,half=bottom,shape=outer_right": { "model": "minecraft:outer_stairs", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=outer_right": { "model": "minecraft:outer_stairs", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=outer_right": { "model": "minecraft:outer_stairs", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=outer_left": { "model": "minecraft:outer_stairs", "y": 270, "uvlock": true },
"facing=west,half=bottom,shape=outer_left": { "model": "minecraft:outer_stairs", "y": 90, "uvlock": true },
"facing=south,half=bottom,shape=outer_left": { "model": "minecraft:outer_stairs" },
"facing=north,half=bottom,shape=outer_left": { "model": "minecraft:outer_stairs", "y": 180, "uvlock": true },
"facing=east,half=bottom,shape=inner_right": { "model": "minecraft:inner_stairs" },
"facing=west,half=bottom,shape=inner_right": { "model": "minecraft:inner_stairs", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=inner_right": { "model": "minecraft:inner_stairs", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=inner_right": { "model": "minecraft:inner_stairs", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=inner_left": { "model": "minecraft:inner_stairs", "y": 270, "uvlock": true },
"facing=west,half=bottom,shape=inner_left": { "model": "minecraft:inner_stairs", "y": 90, "uvlock": true },
"facing=south,half=bottom,shape=inner_left": { "model": "minecraft:inner_stairs" },
"facing=north,half=bottom,shape=inner_left": { "model": "minecraft:inner_stairs", "y": 180, "uvlock": true },
"facing=east,half=top,shape=straight": { "model": "minecraft:stairs", "x": 180, "uvlock": true },
"facing=west,half=top,shape=straight": { "model": "minecraft:stairs", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=straight": { "model": "minecraft:stairs", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=straight": { "model": "minecraft:stairs", "x": 180, "y": 270, "uvlock": true },
"facing=east,half=top,shape=outer_right": { "model": "minecraft:outer_stairs", "x": 180, "y": 90, "uvlock": true },
"facing=west,half=top,shape=outer_right": { "model": "minecraft:outer_stairs", "x": 180, "y": 270, "uvlock": true },
"facing=south,half=top,shape=outer_right": { "model": "minecraft:outer_stairs", "x": 180, "y": 180, "uvlock": true },
"facing=north,half=top,shape=outer_right": { "model": "minecraft:outer_stairs", "x": 180, "uvlock": true },
"facing=east,half=top,shape=outer_left": { "model": "minecraft:outer_stairs", "x": 180, "uvlock": true },
"facing=west,half=top,shape=outer_left": { "model": "minecraft:outer_stairs", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=outer_left": { "model": "minecraft:outer_stairs", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=outer_left": { "model": "minecraft:outer_stairs", "x": 180, "y": 270, "uvlock": true },
"facing=east,half=top,shape=inner_right": { "model": "minecraft:inner_stairs", "x": 180, "y": 90, "uvlock": true },
"facing=west,half=top,shape=inner_right": { "model": "minecraft:inner_stairs", "x": 180, "y": 270, "uvlock": true },
"facing=south,half=top,shape=inner_right": { "model": "minecraft:inner_stairs", "x": 180, "y": 180, "uvlock": true },
"facing=north,half=top,shape=inner_right": { "model": "minecraft:inner_stairs", "x": 180, "uvlock": true },
"facing=east,half=top,shape=inner_left": { "model": "minecraft:inner_stairs", "x": 180, "uvlock": true },
"facing=west,half=top,shape=inner_left": { "model": "minecraft:inner_stairs", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=inner_left": { "model": "minecraft:inner_stairs", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=inner_left": { "model": "minecraft:inner_stairs", "x": 180, "y": 270, "uvlock": true },
"inventory": [{ "model": "minecraft:stairs" }]
}
}

View file

@ -87,6 +87,8 @@ tile.techreborn:fluid_replicator.name=Fluid Replicator
#Blocks
tile.techreborn:rubber_log.name=Rubber Wood
tile.techreborn:rubber_planks.name=Rubber Wood Planks
tile.techreborn:rubber_plank_slab.name=Rubber Plank Slab
tile.techreborn:rubber_plank_stair.name=Rubber Plank Stair
tile.techreborn:rubber_leaves.name=Rubber Leaves
tile.techreborn:rubber_sapling.name=Rubber Sapling

View file

@ -83,11 +83,13 @@ tile.techreborn:auto_crafting_table.name=Автоверстак
#Blocks
tile.techreborn:rubber_log.name=Древесина гевеи
tile.techreborn:rubber_planks.name=Доски из древесины гевеи
tile.techreborn:rubber_plank_slab.name=Плита из древесины гевеи
tile.techreborn:rubber_plank_stair.name=Ступеньки из древесины гевеи
tile.techreborn:rubber_leaves.name=Листва гевеи
tile.techreborn:rubber_sapling.name=Саженец гевеи
tile.techreborn:refined_iron_fence.name=Железный забор
tile.techreborn:alarm.name=аварийная сигнализация
tile.techreborn:alarm.name=Сирена
#Ores
tile.techreborn:ore.galena.name=Галенитовая руда

View file

@ -65,7 +65,7 @@ tile.techreborn:solar_panel.advanced.name=高级太阳能电池板
tile.techreborn:solar_panel.ultimate.name=终极太阳能电池板
tile.techreborn:solar_panel.quantum.name=量子太阳能电池板
tile.techreborn:creative_solar_panel.name=创意面
tile.techreborn:creative_solar_panel.name=创造模式太阳能电池
tile.techreborn:water_mill.name=水力发电机
tile.techreborn:wind_mill.name=风力发电机
tile.techreborn:iron_furnace.name=铁炉
@ -87,6 +87,8 @@ tile.techreborn:fluid_replicator.name=流体复制机
#Blocks
tile.techreborn:rubber_log.name=橡胶木
tile.techreborn:rubber_planks.name=橡胶木板
tile.techreborn:rubber_plank_slab.name=橡胶木台阶
tile.techreborn:rubber_plank_stair.name=橡胶木楼梯
tile.techreborn:rubber_leaves.name=橡胶树叶
tile.techreborn:rubber_sapling.name=橡胶树苗
@ -237,7 +239,7 @@ item.techreborn.dust.coal.name=煤粉
item.techreborn.dust.cobalt.name=钴粉
item.techreborn.dust.copper.name=铜粉
item.techreborn.dust.cupronickel.name=白铜粉
item.techreborn.dust.darkAshes.name=黑色灰烬
item.techreborn.dust.dark_ashes.name=黑色灰烬
item.techreborn.dust.darkIron.name=玄铁粉
item.techreborn.dust.diamond.name=钻石粉
item.techreborn.dust.electrum.name=琥珀金粉
@ -326,12 +328,12 @@ item.techreborn.dustsmall.cinnabar.name=小堆朱砂粉
item.techreborn.dustsmall.clay.name=小堆粘土粉
item.techreborn.dustsmall.coal.name=小堆煤粉
item.techreborn.dustsmall.copper.name=小堆铜粉
item.techreborn.dustsmall.darkAshes.name=小堆黑色灰烬
item.techreborn.dustsmall.dark_ashes.name=小堆黑色灰烬
item.techreborn.dustsmall.diamond.name=小堆钻石粉
item.techreborn.dustsmall.electrum.name=小堆琥珀金粉
item.techreborn.dustsmall.emerald.name=小堆绿宝石粉
item.techreborn.dustsmall.enderEye.name=小堆末影之眼粉
item.techreborn.dustsmall.enderPearl.name=小堆末影珍珠粉
item.techreborn.dustsmall.ender_eye.name=小堆末影之眼粉
item.techreborn.dustsmall.ender_pearl.name=小堆末影珍珠粉
item.techreborn.dustsmall.endstone.name=小堆末地石粉
item.techreborn.dustsmall.flint.name=小堆燧石粉
item.techreborn.dustsmall.galena.name=小堆方铅矿粉
@ -353,12 +355,12 @@ item.techreborn.dustsmall.phosphorous.name=小堆磷粉
item.techreborn.dustsmall.platinum.name=小堆铂粉
item.techreborn.dustsmall.pyrite.name=小堆黄铁矿粉
item.techreborn.dustsmall.pyrope.name=小堆镁铝榴石粉
item.techreborn.dustsmall.redGarnet.name=小堆红色石榴石粉
item.techreborn.dustsmall.red_garnet.name=小堆红色石榴石粉
item.techreborn.dustsmall.redstone.name=小堆红石粉
item.techreborn.dustsmall.ruby.name=小堆红宝石粉
item.techreborn.dustsmall.saltpeter.name=小堆硝石粉
item.techreborn.dustsmall.sapphire.name=小堆蓝宝石粉
item.techreborn.dustsmall.sawDust.name=小堆锯末
item.techreborn.dustsmall.saw_dust.name=小堆锯末
item.techreborn.dustsmall.silver.name=小堆银粉
item.techreborn.dustsmall.sodalite.name=小堆方钠石粉
item.techreborn.dustsmall.spessartine.name=小堆锰铝榴石粉
@ -370,7 +372,7 @@ item.techreborn.dustsmall.titanium.name=小堆钛粉
item.techreborn.dustsmall.tungsten.name=小堆钨粉
item.techreborn.dustsmall.uvarovite.name=小堆钙铬榴石粉
item.techreborn.dustsmall.voidstone.name=小堆虚空石粉
item.techreborn.dustsmall.yellowGarnet.name=小堆黄色石榴石粉
item.techreborn.dustsmall.yellow_garnet.name=小堆黄色石榴石粉
item.techreborn.dustsmall.zinc.name=小堆锌粉
item.techreborn.dustsmall.olivine.name=小堆橄榄石粉
item.techreborn.dustsmall.andesite.name=小堆安山岩粉
@ -675,8 +677,8 @@ keys.techreborn.config=配置
# JEI Integration
techreborn.jei.recipe.start.cost=Start%s
techreborn.jei.recipe.running.cost=%s/t%s
techreborn.jei.recipe.processing.time.1=Time%s ticks
techreborn.jei.recipe.processing.time.2=(%s seconds)
techreborn.jei.recipe.processing.time.1=时间%s ticks
techreborn.jei.recipe.processing.time.2=%s 秒)
jei.techreborn.scrapbox.name=开启废料盒
techreborn.desc.rubberSap=为了获得粘性树脂,你需要找一颗橡胶树或者找到一棵橡胶树苗并且进行种植。当你找到了一个橡胶树后,看看树干有没有黄点。如果没有,过一会就会出现了。为了收获粘性树脂,你需要用一个木龙头对着黄点右击。
techreborn.desc.scrapBox=废料盒可以简单的用手打开也可以用拆包器打开。这是很直接的只要把你的废料盒扔进拆包器并且提供一个红石信号然后boom的一声随机的物品就出现了