397
This commit is contained in:
parent
e8396dbc33
commit
d18d1b820e
65 changed files with 287 additions and 520 deletions
|
@ -24,18 +24,12 @@
|
|||
|
||||
package techreborn;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.minecraft.block.DispenserBlock;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import reborncore.common.multiblock.MultiblockEventHandler;
|
||||
|
@ -55,10 +49,8 @@ import techreborn.tiles.fusionReactor.TileFusionControlComputer;
|
|||
import techreborn.utils.BehaviorDispenseScrapbox;
|
||||
import techreborn.utils.StackWIPHandler;
|
||||
import techreborn.world.village.ModLootTables;
|
||||
import techreborn.world.village.VillagePlantaionHandler;
|
||||
|
||||
@Mod("techreborn")
|
||||
public class TechReborn {
|
||||
public class TechReborn implements ModInitializer {
|
||||
|
||||
public static final String MOD_ID = "techreborn";
|
||||
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
|
||||
|
@ -72,14 +64,8 @@ public class TechReborn {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
public TechReborn() {
|
||||
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
eventBus.addListener(this::setup);
|
||||
eventBus.addListener(this::loadComplete);
|
||||
}
|
||||
|
||||
private void setup(FMLCommonSetupEvent event) {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
INSTANCE = this;
|
||||
|
||||
|
@ -131,47 +117,13 @@ public class TechReborn {
|
|||
}
|
||||
|
||||
Torus.genSizeMap(TileFusionControlComputer.maxCoilSize);
|
||||
LOGGER.info("TechReborn setup done!");
|
||||
}
|
||||
|
||||
private void loadComplete(FMLLoadCompleteEvent event) {
|
||||
|
||||
|
||||
proxy.postInit();
|
||||
|
||||
ModRecipes.postInit();
|
||||
|
||||
//todo: remove, gens localization
|
||||
// for (Item item : ForgeRegistries.ITEMS.getValues()) {
|
||||
// if (item.getRegistryName().getNamespace().equals("techreborn")) {
|
||||
// StringBuilder localName = new StringBuilder();
|
||||
// String[] words = item.getRegistryName().getPath().split("_|\\.");
|
||||
// for (String word : words) {
|
||||
// if (!word.contains("techreborn")) {
|
||||
// if (localName.length() > 0) {
|
||||
// localName.append(" ");
|
||||
// }
|
||||
// localName.append(word);
|
||||
// }
|
||||
// }
|
||||
// System.out.println(item.getRegistryName().getPath());
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (Block item : ForgeRegistries.BLOCKS.getValues()) {
|
||||
// if (item.getRegistryName().getNamespace().equals("techreborn")) {
|
||||
// StringBuilder localName = new StringBuilder();
|
||||
// String[] words = item.getRegistryName().getPath().split("_|\\.");
|
||||
// for (String word : words) {
|
||||
// if (!word.contains("techreborn")) {
|
||||
// if (localName.length() > 0) {
|
||||
// localName.append(" ");
|
||||
// }
|
||||
// localName.append(word);
|
||||
// }
|
||||
// }
|
||||
// System.out.println(item.getRegistryName().getPath());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
LOGGER.info("TechReborn setup done!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,9 +26,10 @@ package techreborn.api.fluidreplicator;
|
|||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.fluid.Fluid;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.tiles.machine.multiblock.TileFluidReplicator;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -27,6 +27,8 @@ package techreborn.api.fluidreplicator;
|
|||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.fluid.Fluid;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Optional;
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
package techreborn.api.generator;
|
||||
|
||||
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.fluid.Fluid;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
public class FluidGeneratorRecipe {
|
||||
private final EFluidGenerator generatorType;
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.api.generator;
|
|||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.fluid.Fluid;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
|
@ -28,15 +28,17 @@ import com.google.gson.JsonObject;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.common.crafting.Recipe;
|
||||
import reborncore.common.crafting.RecipeType;
|
||||
import techreborn.tiles.machine.multiblock.TileIndustrialBlastFurnace;
|
||||
|
||||
public class BlastFurnaceRecipe extends Recipe {
|
||||
public class BlastFurnaceRecipe extends RebornRecipe {
|
||||
|
||||
int heat;
|
||||
|
||||
public BlastFurnaceRecipe(RecipeType<?> type, Identifier name) {
|
||||
public BlastFurnaceRecipe(RebornRecipeType<?> type, Identifier name) {
|
||||
super(type, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,15 +27,17 @@ package techreborn.api.recipe.recipes;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.fluid.FluidStack;
|
||||
import techreborn.tiles.machine.multiblock.TileIndustrialGrinder;
|
||||
|
||||
public class IndustrialGrinderRecipe extends Recipe {
|
||||
public class IndustrialGrinderRecipe extends RebornRecipe {
|
||||
|
||||
//TODO 1.14 fluids
|
||||
FluidStack fluidStack = null;
|
||||
|
||||
public IndustrialGrinderRecipe(RecipeType<?> type, Identifier name) {
|
||||
public IndustrialGrinderRecipe(RebornRecipeType<?> type, Identifier name) {
|
||||
super(type, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,15 +27,17 @@ package techreborn.api.recipe.recipes;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.fluid.FluidStack;
|
||||
import techreborn.tiles.machine.multiblock.TileIndustrialSawmill;
|
||||
|
||||
public class IndustrialSawmillRecipe extends Recipe {
|
||||
public class IndustrialSawmillRecipe extends RebornRecipe {
|
||||
|
||||
//TODO 1.14 fluids
|
||||
FluidStack fluidStack = null;
|
||||
|
||||
public IndustrialSawmillRecipe(RecipeType<?> type, Identifier name) {
|
||||
public IndustrialSawmillRecipe(RebornRecipeType<?> type, Identifier name) {
|
||||
super(type, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ import net.minecraft.state.property.BooleanProperty;
|
|||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
|
@ -130,7 +131,7 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
|
||||
|
||||
|
@ -140,7 +141,7 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, hitResult.getSide())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +152,7 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
|
||||
}
|
||||
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.BlockRotation;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -56,11 +57,11 @@ public class BlockComputerCube extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
|
||||
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
if (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) {
|
||||
if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, side, false)) {
|
||||
if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, hitResult.getSide(), false)) {
|
||||
if (playerIn.isSneaking()) {
|
||||
ItemStack drop = new ItemStack(TRContent.COMPUTER_CUBE, 1);
|
||||
dropStack(worldIn, pos, drop);
|
||||
|
@ -72,7 +73,7 @@ public class BlockComputerCube extends BlockMachineBase {
|
|||
return true;
|
||||
}
|
||||
else {
|
||||
rotate(worldIn.getBlockState(pos), worldIn, pos, BlockRotation.CLOCKWISE_90);
|
||||
rotate(worldIn.getBlockState(pos), BlockRotation.CLOCKWISE_90);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package techreborn.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.GlassBlock;
|
||||
|
@ -38,12 +39,8 @@ import java.util.Random;
|
|||
public class BlockReinforcedGlass extends GlassBlock {
|
||||
|
||||
public BlockReinforcedGlass() {
|
||||
super(Block.Settings.of(Material.GLASS).strength(4f, 60f).sounds(BlockSoundGroup.STONE));
|
||||
super(FabricBlockSettings.of(Material.GLASS).strength(4f, 60f).sounds(BlockSoundGroup.STONE).build());
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(BlockState state, Random random) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package techreborn.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
@ -42,7 +43,7 @@ import techreborn.init.TRContent;
|
|||
public class BlockRubberLeaves extends LeavesBlock {
|
||||
|
||||
public BlockRubberLeaves() {
|
||||
super(Block.Settings.of(Material.LEAVES).strength(0.2F).ticksRandomly().sounds(BlockSoundGroup.GRASS));
|
||||
super(FabricBlockSettings.of(Material.LEAVES).hardness(0.2F).ticksRandomly().sounds(BlockSoundGroup.GRASS).build());
|
||||
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 30, 60);
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, EnvTypeANCE, PERSISTENT));
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import net.minecraft.tag.BlockTags;
|
|||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -92,7 +93,7 @@ public class BlockRubberLog extends LogBlock {
|
|||
int i = 4;
|
||||
int j = i + 1;
|
||||
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) {
|
||||
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
|
||||
for (BlockPos blockpos : BlockPos.iterate(pos.add(-i, -i, -i), pos.add(i, i, i))) {
|
||||
BlockState state1 = worldIn.getBlockState(blockpos);
|
||||
if (state1.matches(BlockTags.LEAVES)) {
|
||||
state1.scheduledTick(worldIn, blockpos, worldIn.getRandom());
|
||||
|
@ -123,9 +124,9 @@ public class BlockRubberLog extends LogBlock {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
|
||||
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
|
||||
Hand hand, BlockHitResult hitResult) {
|
||||
super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
if (stack.isEmpty()) {
|
||||
return false;
|
||||
|
@ -135,7 +136,7 @@ public class BlockRubberLog extends LogBlock {
|
|||
capEnergy = new ItemPowerManager(stack);
|
||||
}
|
||||
if ((capEnergy != null && capEnergy.getEnergyStored() > 20) || stack.getItem() instanceof ItemTreeTap) {
|
||||
if (state.get(HAS_SAP) && state.get(SAP_SIDE) == side) {
|
||||
if (state.get(HAS_SAP) && state.get(SAP_SIDE) == hitResult.getSide()) {
|
||||
worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, Direction.fromHorizontal(0)));
|
||||
worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS,
|
||||
0.6F, 1F);
|
||||
|
@ -148,7 +149,7 @@ public class BlockRubberLog extends LogBlock {
|
|||
playerIn.getStackInHand(Hand.MAIN_HAND).damageItem(1, playerIn);
|
||||
}
|
||||
if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) {
|
||||
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(side));
|
||||
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(hitResult.getSide()));
|
||||
}
|
||||
if (playerIn instanceof ServerPlayerEntity) {
|
||||
TRRecipeHandler.unlockTRRecipes((ServerPlayerEntity) playerIn);
|
||||
|
|
|
@ -36,6 +36,7 @@ import net.minecraft.state.StateFactory;
|
|||
import net.minecraft.state.property.AbstractProperty;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
@ -126,7 +127,7 @@ public class BlockCable extends BlockWithEntity {
|
|||
// Block
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
|
||||
|
||||
|
@ -136,11 +137,11 @@ public class BlockCable extends BlockWithEntity {
|
|||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, hitResult.getSide())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,6 +36,7 @@ import net.minecraft.network.chat.TextComponent;
|
|||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
@ -59,8 +60,8 @@ public class BlockFusionCoil extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
|
||||
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
|
||||
Hand hand, BlockHitResult hitResult) {
|
||||
|
||||
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
if (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
@ -54,8 +55,8 @@ public class BlockFusionControlComputer extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
|
||||
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
|
||||
Hand hand, BlockHitResult hitResult) {
|
||||
final TileFusionControlComputer tileFusionControlComputer = (TileFusionControlComputer) worldIn.getBlockEntity(pos);
|
||||
if(!playerIn.getStackInHand(hand).isEmpty() && (playerIn.getStackInHand(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())){
|
||||
List<BlockPos> coils = Torus.generate(tileFusionControlComputer.getPos(), tileFusionControlComputer.size);
|
||||
|
@ -78,7 +79,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
|
|||
|
||||
}
|
||||
tileFusionControlComputer.checkCoils();
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,6 +40,7 @@ import net.minecraft.state.property.BooleanProperty;
|
|||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
|
@ -142,29 +143,10 @@ public class BlockLamp extends BaseTileBlock {
|
|||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(BlockView worldIn, BlockState state, BlockPos pos, Direction facing) {
|
||||
// This makes only the back face of lamps connect to fences.
|
||||
if (getFacing(state).getOpposite() == facing)
|
||||
return BlockFaceShape.SOLID;
|
||||
else
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos) {
|
||||
return shape[getFacing(state).getId()];
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
|
||||
|
||||
|
@ -174,11 +156,11 @@ public class BlockLamp extends BaseTileBlock {
|
|||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, hitResult.getSide())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraft.state.StateFactory;
|
|||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -102,7 +103,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
|
||||
|
||||
|
@ -112,7 +113,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
|
|||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, hitResult.getSide())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +123,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
|
|||
return true;
|
||||
}
|
||||
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
@ -93,7 +94,7 @@ public class BlockLSUStorage extends BaseTileBlock {
|
|||
// Block
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
|
||||
|
||||
|
@ -103,12 +104,12 @@ public class BlockLSUStorage extends BaseTileBlock {
|
|||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, hitResult.getSide())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,6 +38,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.state.StateFactory;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
@ -90,12 +91,12 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
|
||||
|
||||
if (tileEntity == null) {
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
|
||||
String type = state.get(TYPE);
|
||||
|
@ -103,7 +104,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
|||
ChatFormat color = ChatFormat.GREEN;
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, side, false)) {
|
||||
if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, hitResult.getSide(), false)) {
|
||||
if (playerIn.isSneaking()) {
|
||||
if (tileEntity instanceof IToolDrop) {
|
||||
ItemStack drop = ((IToolDrop) tileEntity).getToolDrop(playerIn);
|
||||
|
|
|
@ -34,9 +34,9 @@ import techreborn.TechReborn;
|
|||
import techreborn.client.EGui;
|
||||
import techreborn.tiles.machine.multiblock.TileEnvTypeillationTower;
|
||||
|
||||
public class BlockEnvTypeillationTower extends BlockMachineBase {
|
||||
public class BlockDistillationTower extends BlockMachineBase {
|
||||
|
||||
public BlockEnvTypeillationTower() {
|
||||
public BlockDistillationTower() {
|
||||
super();
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/tier2_machines"));
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraft.state.StateFactory;
|
|||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -92,7 +93,7 @@ public abstract class BlockTransformer extends BaseTileBlock {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
|
||||
|
||||
|
@ -102,11 +103,11 @@ public abstract class BlockTransformer extends BaseTileBlock {
|
|||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
if (WrenchUtils.handleWrench(stack, worldIn, pos, playerIn, hitResult.getSide())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.activate(state, worldIn, pos, playerIn, hand, hitResult);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class GuiAlloyFurnace extends AbstractContainerScreen {
|
|||
protected void drawBackground(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
|
||||
this.drawDefaultBackground();
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(GuiAlloyFurnace.texture);
|
||||
this.minecraft.getTextureManager().bindTexture(GuiAlloyFurnace.texture);
|
||||
final int k = (this.width - this.containerWidth) / 2;
|
||||
final int l = (this.height - this.containerHeight) / 2;
|
||||
this.blit(k, l, 0, 0, this.containerWidth, this.containerHeight);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
|
|
|
@ -53,8 +53,8 @@ public class GuiChunkLoader extends AbstractContainerScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
public void init() {
|
||||
super.init();
|
||||
this.left = this.width / 2 - this.containerWidth / 2;
|
||||
this.top = this.height / 2 - this.containerHeight / 2;
|
||||
this.plusOneButton = new GuiButtonSimple(0, this.left + 5, this.top + 37, 40, 20, "+1");
|
||||
|
@ -73,7 +73,7 @@ public class GuiChunkLoader extends AbstractContainerScreen {
|
|||
protected void drawBackground(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
|
||||
this.drawDefaultBackground();
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(GuiChunkLoader.texture);
|
||||
minecraft.getTextureManager().bindTexture(GuiChunkLoader.texture);
|
||||
final int k = (this.width - this.containerWidth) / 2;
|
||||
final int l = (this.height - this.containerHeight) / 2;
|
||||
this.blit(k, l, 0, 0, this.containerWidth, this.containerHeight);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
|
|
@ -57,8 +57,8 @@ public class GuiFluidReplicator extends GuiBase {
|
|||
|
||||
// GuiBase
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
public void init() {
|
||||
super.init();
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ public class GuiFusionReactor extends GuiBase {
|
|||
}
|
||||
}
|
||||
builder.drawUpDownButtons(this, 121, 79, layer);
|
||||
draw("Size: " + tile.size, 83, 81, 0xFFFFFF, layer);
|
||||
draw("" + tile.getPowerMultiplier() + "x", 10, 81, 0xFFFFFF, layer);
|
||||
drawString("Size: " + tile.size, 83, 81, 0xFFFFFF, layer);
|
||||
drawString("" + tile.getPowerMultiplier() + "x", 10, 81, 0xFFFFFF, layer);
|
||||
|
||||
buttons.add(new GuiButtonUpDown(300, 121, 79, this, GuiBase.Layer.FOREGROUND));
|
||||
buttons.add(new GuiButtonUpDown(301, 121 + 12, 79, this, GuiBase.Layer.FOREGROUND));
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
|
|
|
@ -49,8 +49,8 @@ public class GuiImplosionCompressor extends GuiBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
public void init() {
|
||||
super.init();
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ public class GuiIndustrialGrinder extends GuiBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
public void init() {
|
||||
super.init();
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -52,7 +53,7 @@ public class GuiIronFurnace extends GuiBase {
|
|||
drawDefaultBackground();
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
builder.drawSlotTab(this, left - 24, top + 6, new ItemStack(TRContent.WRENCH));
|
||||
mc.getTextureManager().bindTexture(GuiIronFurnace.texture);
|
||||
minecraft.getTextureManager().bindTexture(GuiIronFurnace.texture);
|
||||
final int k = (this.width - containerWidth) / 2;
|
||||
final int l = (this.height - containerHeight) / 2;
|
||||
blit(k, l, 0, 0, containerWidth, containerHeight);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
|
|
|
@ -24,19 +24,18 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.ingame.ConfirmChatLinkScreen;
|
||||
import net.minecraft.client.gui.screen.ConfirmChatLinkScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
|
||||
import techreborn.items.ItemManual;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
|
||||
import java.awt.*;
|
||||
import net.minecraft.client.gui.Screen;
|
||||
import net.minecraft.client.gui.ingame.ConfirmChatLinkScreen;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
||||
public class GuiManual extends Screen {
|
||||
|
@ -61,7 +60,7 @@ public class GuiManual extends Screen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
public void init() {
|
||||
int y = height / 4;
|
||||
buttons.add(new GuiButtonExtended(1, (width / 2 - 30), y + 10, 60, 20, I18n.translate("techreborn.manual.wikibtn")));
|
||||
buttons.add(new GuiButtonExtended(2, (width / 2 - 30), y + 60, 60, 20, I18n.translate("techreborn.manual.discordbtn")));
|
||||
|
@ -73,7 +72,7 @@ public class GuiManual extends Screen {
|
|||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
drawDefaultBackground();
|
||||
mc.getTextureManager().bindTexture(GuiManual.texture);
|
||||
minecraft.getTextureManager().bindTexture(GuiManual.texture);
|
||||
int centerX = (width / 2) - guiWidth / 2;
|
||||
int centerY = (height / 2) - guiHeight / 2;
|
||||
blit(centerX, centerY, 0, 0, guiWidth, guiHeight);
|
||||
|
@ -89,13 +88,13 @@ public class GuiManual extends Screen {
|
|||
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
|
||||
switch (button.id) {
|
||||
case 1:
|
||||
mc.displayGuiScreen(new ConfirmChatLinkScreen(this, "http://wiki.techreborn.ovh", 1, false));
|
||||
minecraft.openScreen(new ConfirmChatLinkScreen(this, "http://wiki.techreborn.ovh", 1, false));
|
||||
break;
|
||||
case 2:
|
||||
this.mc.displayGuiScreen(new ConfirmChatLinkScreen(this, "https://discord.gg/teamreborn", 2, false));
|
||||
this.minecraft.openScreen(new ConfirmChatLinkScreen(this, "https://discord.gg/teamreborn", 2, false));
|
||||
break;
|
||||
case 3:
|
||||
mc.displayGuiScreen(null);
|
||||
minecraft.openScreen(null);
|
||||
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
|
||||
break;
|
||||
}
|
||||
|
@ -112,7 +111,7 @@ public class GuiManual extends Screen {
|
|||
System.err.print(e);
|
||||
}
|
||||
}else {
|
||||
mc.displayGuiScreen(this);
|
||||
minecraft.openScreen(this);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -123,7 +122,7 @@ public class GuiManual extends Screen {
|
|||
System.err.print(e);
|
||||
}
|
||||
}else {
|
||||
mc.displayGuiScreen(this);
|
||||
minecraft.openScreen(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ public class GuiVacuumFreezer extends GuiBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
public void init() {
|
||||
super.init();
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.entity.MovementType;
|
|||
import net.minecraft.entity.PrimedTntEntity;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.explosion.RebornExplosion;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
|
@ -66,21 +67,28 @@ public class EntityNukePrimed extends PrimedTntEntity {
|
|||
this.prevY = this.y;
|
||||
this.prevZ = this.z;
|
||||
|
||||
Vec3d velocity = getVelocity();
|
||||
double motionX = velocity.x;
|
||||
double motionY = velocity.y;
|
||||
double motionZ = velocity.z;
|
||||
|
||||
if (!this.hasNoGravity()) {
|
||||
this.motionY -= 0.03999999910593033D;
|
||||
motionY -= 0.03999999910593033D;
|
||||
}
|
||||
|
||||
this.move(MovementType.SELF, this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.9800000190734863D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
this.move(MovementType.SELF, new Vec3d(motionX, motionZ, motionY));
|
||||
motionX *= 0.9800000190734863D;
|
||||
motionY *= 0.9800000190734863D;
|
||||
motionZ *= 0.9800000190734863D;
|
||||
|
||||
if (this.onGround) {
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -0.5D;
|
||||
motionX *= 0.699999988079071D;
|
||||
motionZ *= 0.699999988079071D;
|
||||
motionY *= -0.5D;
|
||||
}
|
||||
|
||||
setVelocity(new Vec3d(motionX, motionZ, motionY));
|
||||
|
||||
setFuse(getFuseTimer() - 1);
|
||||
|
||||
if (getFuseTimer() <= 0) {
|
||||
|
|
|
@ -34,7 +34,6 @@ import net.fabricmc.api.Environment;
|
|||
import reborncore.client.models.ModelCompound;
|
||||
import reborncore.client.models.RebornModelRegistry;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.client.render.ModelDynamicCell;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRContent.*;
|
||||
|
@ -46,15 +45,12 @@ import java.util.Arrays;
|
|||
*
|
||||
*/
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mod.EventBusSubscriber(modid = TechReborn.MOD_ID)
|
||||
public class ModelRegistryEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event) {
|
||||
public static void registerModels() {
|
||||
registerBlocks();
|
||||
registerFluidBlocks();
|
||||
registerItems();
|
||||
ModelDynamicCell.init();
|
||||
//RebornModelRegistry.registerModels(TechReborn.MOD_ID);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Identifier;
|
||||
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.common.crafting.RecipeManager;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import techreborn.TechReborn;
|
||||
|
@ -39,23 +40,23 @@ import techreborn.api.recipe.recipes.IndustrialSawmillRecipe;
|
|||
public class ModRecipes {
|
||||
|
||||
|
||||
public static final RecipeType<RebornRecipe> ALLOY_SMELTER = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:alloy_smelter"));
|
||||
public static final RecipeType<Recipe> ASSEMBLING_MACHINE = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:assembling_machine"));
|
||||
public static final RecipeType<BlastFurnaceRecipe> BLAST_FURNACE = RecipeManager.newRecipeType(BlastFurnaceRecipe.class, new Identifier("techreborn:blast_furnace"));
|
||||
public static final RecipeType<Recipe> CENTRIFUGE = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:centrifuge"));
|
||||
public static final RecipeType<Recipe> CHEMICAL_REACTOR = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:chemical_reactor"));
|
||||
public static final RecipeType<Recipe> COMPRESSOR = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:compressor"));
|
||||
public static final RecipeType<Recipe> EnvTypeILLATION_TOWER = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:EnvTypeillation_tower"));
|
||||
public static final RecipeType<Recipe> EXTRACTOR = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:extractor"));
|
||||
public static final RecipeType<Recipe> GRINDER = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:grinder"));
|
||||
public static final RecipeType<Recipe> IMPLOSION_COMPRESSOR = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:implosion_compressor"));
|
||||
public static final RecipeType<Recipe> INDUSTRIAL_ELECTROLYZER = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:industrial_electrolyzer"));
|
||||
public static final RecipeType<IndustrialGrinderRecipe> INDUSTRIAL_GRINDER = RecipeManager.newRecipeType(IndustrialGrinderRecipe.class, new Identifier("techreborn:industrial_grinder"));
|
||||
public static final RecipeType<IndustrialSawmillRecipe> INDUSTRIAL_SAWMILL = RecipeManager.newRecipeType(IndustrialSawmillRecipe.class, new Identifier("techreborn:industrial_sawmill"));
|
||||
public static final RecipeType<Recipe> RECYCLER = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:recycler"));
|
||||
public static final RecipeType<Recipe> SCRAPBOX = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:scrapbox"));
|
||||
public static final RecipeType<Recipe> VACUUM_FREEZER = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:vacuum_freezer"));
|
||||
public static final RecipeType<Recipe> FLUID_REPLICATOR = RecipeManager.newRecipeType(Recipe.class, new Identifier("techreborn:fluid_replicator"));
|
||||
public static final RebornRecipeType<RebornRecipe> ALLOY_SMELTER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:alloy_smelter"));
|
||||
public static final RebornRecipeType<RebornRecipe> ASSEMBLING_MACHINE = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:assembling_machine"));
|
||||
public static final RebornRecipeType<BlastFurnaceRecipe> BLAST_FURNACE = RecipeManager.newRecipeType(BlastFurnaceRecipe.class, new Identifier("techreborn:blast_furnace"));
|
||||
public static final RebornRecipeType<RebornRecipe> CENTRIFUGE = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:centrifuge"));
|
||||
public static final RebornRecipeType<RebornRecipe> CHEMICAL_REACTOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:chemical_reactor"));
|
||||
public static final RebornRecipeType<RebornRecipe> COMPRESSOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:compressor"));
|
||||
public static final RebornRecipeType<RebornRecipe> EnvTypeILLATION_TOWER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:EnvTypeillation_tower"));
|
||||
public static final RebornRecipeType<RebornRecipe> EXTRACTOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:extractor"));
|
||||
public static final RebornRecipeType<RebornRecipe> GRINDER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:grinder"));
|
||||
public static final RebornRecipeType<RebornRecipe> IMPLOSION_COMPRESSOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:implosion_compressor"));
|
||||
public static final RebornRecipeType<RebornRecipe> INDUSTRIAL_ELECTROLYZER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:industrial_electrolyzer"));
|
||||
public static final RebornRecipeType<IndustrialGrinderRecipe> INDUSTRIAL_GRINDER = RecipeManager.newRecipeType(IndustrialGrinderRecipe.class, new Identifier("techreborn:industrial_grinder"));
|
||||
public static final RebornRecipeType<IndustrialSawmillRecipe> INDUSTRIAL_SAWMILL = RecipeManager.newRecipeType(IndustrialSawmillRecipe.class, new Identifier("techreborn:industrial_sawmill"));
|
||||
public static final RebornRecipeType<RebornRecipe> RECYCLER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:recycler"));
|
||||
public static final RebornRecipeType<RebornRecipe> SCRAPBOX = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:scrapbox"));
|
||||
public static final RebornRecipeType<RebornRecipe> VACUUM_FREEZER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:vacuum_freezer"));
|
||||
public static final RebornRecipeType<RebornRecipe> FLUID_REPLICATOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:fluid_replicator"));
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ public class TRContent {
|
|||
AUTO_CRAFTING_TABLE(new BlockAutoCraftingTable()),
|
||||
CHEMICAL_REACTOR(new BlockChemicalReactor()),
|
||||
COMPRESSOR(new BlockCompressor()),
|
||||
EnvTypeILLATION_TOWER(new BlockEnvTypeillationTower()),
|
||||
EnvTypeILLATION_TOWER(new BlockDistillationTower()),
|
||||
EXTRACTOR(new BlockExtractor()),
|
||||
FLUID_REPLICATOR(new BlockFluidReplicator()),
|
||||
GRINDER(new BlockGrinder()),
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.init.recipes;
|
||||
|
||||
|
||||
import reborncore.fluid.Fluid;
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.api.generator.GeneratorRecipeHelper;
|
||||
import techreborn.init.ModFluids;
|
||||
|
|
|
@ -24,31 +24,17 @@
|
|||
|
||||
package techreborn.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FluidBlock;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import reborncore.fluid.Fluid;
|
||||
import reborncore.fluid.FluidStack;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -59,7 +45,7 @@ import techreborn.utils.FluidUtils;
|
|||
*/
|
||||
public class DynamicCell extends Item {
|
||||
|
||||
public static final int CAPACITY = Fluid.BUCKET_VOLUME;
|
||||
public static final int CAPACITY = 1000;
|
||||
|
||||
public DynamicCell() {
|
||||
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
|
||||
|
@ -81,64 +67,6 @@ public class DynamicCell extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World worldIn, PlayerEntity playerIn, Hand hand) {
|
||||
ItemStack stack = playerIn.getStackInHand(hand);
|
||||
if (!worldIn.isClient) {
|
||||
HitResult result = rayTrace(worldIn, playerIn, true);
|
||||
|
||||
if (result != null && result.type == HitResult.Type.BLOCK) {
|
||||
BlockPos pos = result.getBlockPos();
|
||||
BlockState state = worldIn.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (block instanceof IFluidBlock) {
|
||||
IFluidBlock fluidBlock = (IFluidBlock) block;
|
||||
|
||||
if (fluidBlock.canDrain(worldIn, pos)) {
|
||||
FluidStack fluid = fluidBlock.drain(worldIn, pos, false);
|
||||
|
||||
if (fluid != null && fluid.amount == DynamicCell.CAPACITY) {
|
||||
if (tryAddCellToInventory(playerIn, stack, fluid.getFluid())) {
|
||||
fluidBlock.drain(worldIn, pos, true);
|
||||
return TypedActionResult.newResult(ActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (block instanceof FluidBlock) {
|
||||
//TODO 1.13 fix me
|
||||
// Fluid fluid = state.getMaterial() == Material.LAVA ? Fluids.LAVA : Fluids.WATER;
|
||||
//
|
||||
// if (tryAddCellToInventory(playerIn, stack, fluid)) {
|
||||
// if (fluid != Fluids.WATER)
|
||||
// worldIn.setBlockToAir(pos);
|
||||
// return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
// }
|
||||
|
||||
} else {
|
||||
ItemStack usedCell = stack.copy();
|
||||
usedCell.setAmount(1);
|
||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(usedCell).orElseGet(null);
|
||||
if (fluidHandler != null) {
|
||||
FluidStack fluid = fluidHandler.drain(DynamicCell.CAPACITY, false);
|
||||
if (fluid != null){
|
||||
if(FluidUtil.tryPlaceFluid(playerIn, worldIn, pos.offset(result.sideHit), fluidHandler, fluid)){
|
||||
stack.subtractAmount(1);
|
||||
playerIn.inventory.insertStack(getEmptyCell(1));
|
||||
return TypedActionResult.newResult(ActionResult.SUCCESS, stack);
|
||||
}
|
||||
return TypedActionResult.newResult(ActionResult.FAIL, stack);
|
||||
}
|
||||
return TypedActionResult.newResult(ActionResult.FAIL, stack);
|
||||
}
|
||||
return TypedActionResult.newResult(ActionResult.FAIL, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TypedActionResult.newResult(ActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
public boolean tryAddCellToInventory(PlayerEntity player, ItemStack stack, Fluid fluid) {
|
||||
if (player.inventory.insertStack(DynamicCell.getCellWithFluid(fluid))) {
|
||||
|
@ -159,22 +87,19 @@ public class DynamicCell extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack stack) {
|
||||
FluidStack fluidStack = getFluidHandler(stack).getFluid();
|
||||
if (fluidStack == null)
|
||||
return super.getTranslationKey(stack);
|
||||
return StringUtils.t("item.techreborn.cell.fluid.name").replaceAll("\\$fluid\\$", fluidStack.getLocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag nbt) {
|
||||
return getFluidHandler(stack);
|
||||
}
|
||||
|
||||
public static FluidHandler getFluidHandler(ItemStack stack) {
|
||||
return new FluidHandler(stack, CAPACITY);
|
||||
}
|
||||
// @Override
|
||||
// public String getTranslationKey(ItemStack stack) {
|
||||
// FluidStack fluidStack = getFluidHandler(stack).getFluid();
|
||||
// if (fluidStack == null)
|
||||
// return super.getTranslationKey(stack);
|
||||
// return StringUtils.t("item.techreborn.cell.fluid.name").replaceAll("\\$fluid\\$", fluidStack.getLocalizedName());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag nbt) {
|
||||
// return getFluidHandler(stack);
|
||||
// }
|
||||
//
|
||||
|
||||
public static ItemStack getCellWithFluid(Fluid fluid, int stackSize) {
|
||||
Validate.notNull(fluid);
|
||||
|
@ -192,61 +117,5 @@ public class DynamicCell extends Item {
|
|||
return getCellWithFluid(fluid, 1);
|
||||
}
|
||||
|
||||
public static class FluidHandler extends FluidHandlerItemStack {
|
||||
|
||||
public FluidHandler(ItemStack container, int capacity) {
|
||||
super(container, capacity);
|
||||
|
||||
//backwards compatibility
|
||||
if (container.hasTag() && container.getTag().containsKey("FluidName")) {
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTag());
|
||||
if (stack != null) {
|
||||
container.setTag(new CompoundTag());
|
||||
fill(stack, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
if(resource == null)
|
||||
return 0;
|
||||
//Done to allow mods that try to move max int of fluid, allows the cells to work with thermal tanks.
|
||||
if(resource.amount > capacity){
|
||||
resource.amount = capacity;
|
||||
}
|
||||
if (resource.amount != capacity)
|
||||
return 0;
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
//Done to allow mods that try to move max int of fluid, allows the cells to work with thermal tanks.
|
||||
if(maxDrain > capacity){
|
||||
maxDrain = capacity;
|
||||
}
|
||||
if (maxDrain != capacity)
|
||||
return null;
|
||||
return super.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainer() {
|
||||
ItemStack cell;
|
||||
if (container.hasTag() && container.getTag().contains(FLUID_NBT_KEY)) {
|
||||
cell = super.getContainer();
|
||||
}
|
||||
else {
|
||||
cell = new ItemStack(TRContent.CELL, 1);
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setContainerToEmpty() {
|
||||
container = new ItemStack(TRContent.CELL, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,11 +119,6 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
|
|
|
@ -38,6 +38,7 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
@ -45,7 +46,7 @@ import techreborn.init.TRContent;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo {
|
||||
public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
|
||||
// 400M FE maxCharge and 100k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = ConfigTechReborn.LapotronPackCharge;
|
||||
|
@ -92,13 +93,6 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -37,8 +37,8 @@ import net.fabricmc.api.Environment;
|
|||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
@ -46,7 +46,7 @@ import techreborn.init.TRContent;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo {
|
||||
public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
|
||||
// 8M FE maxCharge and 2k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
|
||||
|
@ -93,12 +93,6 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.item.ArmorItem;
|
|||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
@ -36,7 +37,7 @@ import techreborn.events.TRRecipeHandler;
|
|||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
*/
|
||||
public class ItemTRArmour extends ArmorItem {
|
||||
public class ItemTRArmour extends ArmorItem implements ItemDurabilityExtensions {
|
||||
|
||||
String repairOreDict = "";
|
||||
|
||||
|
|
|
@ -80,14 +80,6 @@ public class ItemBattery extends Item implements IEnergyItemInfo {
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
|
|
|
@ -43,13 +43,14 @@ import reborncore.common.powerSystem.ExternalPowerSystems;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemChainsaw extends AxeItem implements IEnergyItemInfo {
|
||||
public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -120,14 +121,6 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo {
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
|
||||
return !(newStack.isEqualIgnoreTags(oldStack));
|
||||
|
|
|
@ -42,13 +42,14 @@ import reborncore.common.powerSystem.ExternalPowerSystems;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemDrill extends PickaxeItem implements IEnergyItemInfo {
|
||||
public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -115,14 +116,6 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo {
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
|
||||
return !(newStack.isEqualIgnoreTags(oldStack));
|
||||
|
|
|
@ -43,6 +43,7 @@ import reborncore.common.powerSystem.ExternalPowerSystems;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.TagUtils;
|
||||
|
@ -50,7 +51,7 @@ import techreborn.utils.TagUtils;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo {
|
||||
public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -118,14 +119,6 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo {
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
|
||||
return !(newStack.isEqualIgnoreTags(oldStack));
|
||||
|
|
|
@ -27,6 +27,7 @@ package techreborn.items.tool;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -45,7 +46,7 @@ public class ItemWrench extends Item implements IToolHandler {
|
|||
@Override
|
||||
public boolean handleTool(ItemStack stack, BlockPos pos, World world, PlayerEntity player, Direction side, boolean damage) {
|
||||
if (damage) {
|
||||
stack.damageItem(1, player);
|
||||
stack.applyDamage(1, player.world.random, (ServerPlayerEntity) player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import reborncore.common.powerSystem.ExternalPowerSystems;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
@ -51,7 +52,7 @@ import techreborn.init.TRContent;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo {
|
||||
public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.RockCutterCharge;
|
||||
public int transferLimit = 1_000;
|
||||
|
@ -130,12 +131,6 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo {
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
|
||||
return !(newStack.isEqualIgnoreTags(oldStack));
|
||||
|
|
|
@ -39,6 +39,7 @@ import reborncore.common.powerSystem.ExternalPowerSystems;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
|
@ -49,7 +50,7 @@ import javax.annotation.Nullable;
|
|||
/**
|
||||
* Created by modmuss50 on 05/11/2016.
|
||||
*/
|
||||
public class ItemElectricTreetap extends Item implements IEnergyItemInfo {
|
||||
public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = 10_000;
|
||||
public int cost = 20;
|
||||
|
@ -88,12 +89,6 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo {
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
|
||||
|
|
|
@ -51,6 +51,7 @@ import reborncore.common.powerSystem.PowerSystem;
|
|||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
@ -60,7 +61,7 @@ import techreborn.utils.MessageIDs;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNanosaber extends SwordItem implements IEnergyItemInfo {
|
||||
public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public static final int maxCharge = ConfigTechReborn.nanoSaberCharge;
|
||||
public int transferLimit = 1_000;
|
||||
public int cost = 250;
|
||||
|
@ -188,14 +189,6 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo {
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void appendItemsForGroup(
|
||||
|
|
|
@ -46,6 +46,7 @@ import reborncore.common.powerSystem.ExternalPowerSystems;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.ItemPowerManager;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.TechReborn;
|
||||
|
@ -55,7 +56,7 @@ import techreborn.init.TRContent;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo {
|
||||
public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.OmniToolCharge;
|
||||
public int transferLimit = 1_000;
|
||||
|
@ -153,12 +154,6 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo {
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
||||
return new PoweredItemContainerProvider(stack);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void appendItemsForGroup(
|
||||
|
|
|
@ -24,10 +24,15 @@
|
|||
|
||||
package techreborn.packets;
|
||||
|
||||
import net.fabricmc.fabric.api.network.PacketContext;
|
||||
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import reborncore.common.network.ExtendedPacketBuffer;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import reborncore.common.network.NetworkPacket;
|
||||
|
@ -40,7 +45,6 @@ import techreborn.tiles.storage.TileAdjustableSU;
|
|||
import techreborn.tiles.storage.idsu.TileInterdimensionalSU;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ServerboundPackets {
|
||||
|
||||
|
@ -50,45 +54,45 @@ public class ServerboundPackets {
|
|||
public static final Identifier FUSION_CONTROL_SIZE = new Identifier("techreborn", "fusion_control_size");
|
||||
public static final Identifier IDSU = new Identifier("techreborn", "idsu");
|
||||
public static final Identifier REFUND = new Identifier("techreborn", "refund");
|
||||
|
||||
|
||||
public static void init() {
|
||||
NetworkManager.registerPacketHandler(AESU, (extendedPacketBuffer, context) -> {
|
||||
registerPacketHandler(AESU, (extendedPacketBuffer, context) -> {
|
||||
BlockPos pos = extendedPacketBuffer.readBlockPos();
|
||||
int buttonID = extendedPacketBuffer.readInt();
|
||||
context.enqueueWork(() -> {
|
||||
TileEntity tile = context.getSender().world.getTileEntity(pos);
|
||||
context.getTaskQueue().execute(() -> {
|
||||
BlockEntity tile = context.getPlayer().world.getBlockEntity(pos);
|
||||
if (tile instanceof TileAdjustableSU) {
|
||||
((TileAdjustableSU) tile).handleGuiInputFromClient(buttonID, false, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
NetworkManager.registerPacketHandler(AUTO_CRAFTING_LOCK, (extendedPacketBuffer, context) -> {
|
||||
registerPacketHandler(AUTO_CRAFTING_LOCK, (extendedPacketBuffer, context) -> {
|
||||
BlockPos machinePos = extendedPacketBuffer.readBlockPos();
|
||||
boolean locked = extendedPacketBuffer.readBoolean();
|
||||
context.enqueueWork(() -> {
|
||||
TileEntity tileEntity = context.getSender().world.getTileEntity(machinePos);
|
||||
if (tileEntity instanceof TileAutoCraftingTable) {
|
||||
((TileAutoCraftingTable) tileEntity).locked = locked;
|
||||
context.getTaskQueue().execute(() -> {
|
||||
BlockEntity BlockEntity = context.getPlayer().world.getBlockEntity(machinePos);
|
||||
if (BlockEntity instanceof TileAutoCraftingTable) {
|
||||
((TileAutoCraftingTable) BlockEntity).locked = locked;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
NetworkManager.registerPacketHandler(FUSION_CONTROL_SIZE, (extendedPacketBuffer, context) -> {
|
||||
registerPacketHandler(FUSION_CONTROL_SIZE, (extendedPacketBuffer, context) -> {
|
||||
int sizeDelta = extendedPacketBuffer.readInt();
|
||||
BlockPos pos = extendedPacketBuffer.readBlockPos();
|
||||
context.enqueueWork(() -> {
|
||||
TileEntity tile = context.getSender().world.getTileEntity(pos);
|
||||
context.getTaskQueue().execute(() -> {
|
||||
BlockEntity tile = context.getPlayer().world.getBlockEntity(pos);
|
||||
if (tile instanceof TileFusionControlComputer) {
|
||||
((TileFusionControlComputer) tile).changeSize(sizeDelta);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
NetworkManager.registerPacketHandler(IDSU, (extendedPacketBuffer, context) -> {
|
||||
registerPacketHandler(IDSU, (extendedPacketBuffer, context) -> {
|
||||
BlockPos pos = extendedPacketBuffer.readBlockPos();
|
||||
int buttonID = extendedPacketBuffer.readInt();
|
||||
context.enqueueWork(() -> {
|
||||
context.getTaskQueue().execute(() -> {
|
||||
//TODO was commented out when I ported it, so ill leave it here, needs looking into tho
|
||||
// if (!pos.getWorld().isRemote) {
|
||||
// pos.handleGuiInputFromClient(buttonID);
|
||||
|
@ -96,27 +100,27 @@ public class ServerboundPackets {
|
|||
});
|
||||
});
|
||||
|
||||
NetworkManager.registerPacketHandler(ROLLING_MACHINE_LOCK, (extendedPacketBuffer, context) -> {
|
||||
registerPacketHandler(ROLLING_MACHINE_LOCK, (extendedPacketBuffer, context) -> {
|
||||
BlockPos machinePos = extendedPacketBuffer.readBlockPos();
|
||||
boolean locked = extendedPacketBuffer.readBoolean();
|
||||
context.enqueueWork(() -> {
|
||||
TileEntity tileEntity = context.getSender().world.getTileEntity(machinePos);
|
||||
if (tileEntity instanceof TileRollingMachine) {
|
||||
((TileRollingMachine) tileEntity).locked = locked;
|
||||
context.getTaskQueue().execute(() -> {
|
||||
BlockEntity BlockEntity = context.getPlayer().world.getBlockEntity(machinePos);
|
||||
if (BlockEntity instanceof TileRollingMachine) {
|
||||
((TileRollingMachine) BlockEntity).locked = locked;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
NetworkManager.registerPacketHandler(REFUND, (extendedPacketBuffer, context) -> {
|
||||
registerPacketHandler(REFUND, (extendedPacketBuffer, context) -> {
|
||||
if(!ItemManual.allowRefund){
|
||||
return;
|
||||
}
|
||||
context.enqueueWork(() -> {
|
||||
EntityPlayerMP playerMP = context.getSender();
|
||||
for (int i = 0; i < playerMP.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = playerMP.inventory.getStackInSlot(i);
|
||||
context.getTaskQueue().execute(() -> {
|
||||
PlayerEntity playerMP = context.getPlayer();
|
||||
for (int i = 0; i < playerMP.inventory.getInvSize(); i++) {
|
||||
ItemStack stack = playerMP.inventory.getInvStack(i);
|
||||
if (stack.getItem() == TRContent.MANUAL) {
|
||||
playerMP.inventory.removeStackFromSlot(i);
|
||||
playerMP.inventory.removeInvStack(i);
|
||||
playerMP.inventory.addItemStackToInventory(new ItemStack(Items.BOOK));
|
||||
//TODO 1.13
|
||||
//playerMP.inventory.addItemStackToInventory(OreUtil.getStackFromName("ingotRefinedIron"));
|
||||
|
@ -128,6 +132,10 @@ public class ServerboundPackets {
|
|||
});
|
||||
}
|
||||
|
||||
private static void registerPacketHandler(Identifier identifier, BiConsumer<ExtendedPacketBuffer, PacketContext> consumer){
|
||||
ServerSidePacketRegistry.INSTANCE.register(identifier, (packetContext, packetByteBuf) -> consumer.accept(new ExtendedPacketBuffer(packetByteBuf), packetContext));
|
||||
}
|
||||
|
||||
public static NetworkPacket createPacketAesu(int buttonID, TileAdjustableSU tile) {
|
||||
return NetworkManager.createPacket(AESU, extendedPacketBuffer -> {
|
||||
extendedPacketBuffer.writeBlockPos(tile.getPos());
|
||||
|
|
|
@ -218,22 +218,6 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap) {
|
||||
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
|
||||
return LazyOptional.of(new NonNullSupplier<T>() {
|
||||
@Nonnull
|
||||
@Override
|
||||
public T get() {
|
||||
return (T) inventory;
|
||||
}
|
||||
});
|
||||
}
|
||||
return super.getCapability(cap);
|
||||
}
|
||||
|
||||
// ItemHandlerProvider
|
||||
@Override
|
||||
public Inventory<TileTechStorageBase> getInventory() {
|
||||
|
|
|
@ -34,7 +34,7 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.Tickable;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public class TileCable extends BlockEntity
|
||||
implements ITickable, IEnergyStorage, IListInfoProvider, IToolDrop {
|
||||
implements Tickable, IEnergyStorage, IListInfoProvider, IToolDrop {
|
||||
|
||||
public int power = 0;
|
||||
private int transferRate = 0;
|
||||
|
@ -84,14 +84,6 @@ public class TileCable extends BlockEntity
|
|||
}
|
||||
return canReceive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(Capability<T> capability) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return LazyOptional.of(() -> (T)this);
|
||||
}
|
||||
return super.getCapability(capability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toInitialChunkDataTag() {
|
||||
|
@ -151,37 +143,39 @@ public class TileCable extends BlockEntity
|
|||
return;
|
||||
}
|
||||
|
||||
ArrayList<IEnergyStorage> acceptors = new ArrayList<IEnergyStorage>();
|
||||
for (Direction face : Direction.values()) {
|
||||
BlockEntity tile = world.getBlockEntity(pos.offset(face));
|
||||
//TODO needs a full recode to not use a specific power net
|
||||
|
||||
if (tile == null) {
|
||||
continue;
|
||||
} else if (tile instanceof TileCable) {
|
||||
TileCable cable = (TileCable) tile;
|
||||
if (power > cable.power && cable.canReceiveFromFace(face.getOpposite())) {
|
||||
acceptors.add((IEnergyStorage) tile);
|
||||
if (!sendingFace.contains(face)) {
|
||||
sendingFace.add(face);
|
||||
}
|
||||
}
|
||||
} else if (tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite()).isPresent()) {
|
||||
IEnergyStorage energyTile = tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite()).orElse(null);
|
||||
if (energyTile != null && energyTile.canReceive()) {
|
||||
acceptors.add(energyTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
// ArrayList<IEnergyStorage> acceptors = new ArrayList<IEnergyStorage>();
|
||||
// for (Direction face : Direction.values()) {
|
||||
// BlockEntity tile = world.getBlockEntity(pos.offset(face));
|
||||
//
|
||||
// if (tile == null) {
|
||||
// continue;
|
||||
// } else if (tile instanceof TileCable) {
|
||||
// TileCable cable = (TileCable) tile;
|
||||
// if (power > cable.power && cable.canReceiveFromFace(face.getOpposite())) {
|
||||
// acceptors.add((IEnergyStorage) tile);
|
||||
// if (!sendingFace.contains(face)) {
|
||||
// sendingFace.add(face);
|
||||
// }
|
||||
// }
|
||||
// } else if (tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite()).isPresent()) {
|
||||
// IEnergyStorage energyTile = tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite()).orElse(null);
|
||||
// if (energyTile != null && energyTile.canReceive()) {
|
||||
// acceptors.add(energyTile);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// IEnergyStorage
|
||||
|
|
|
@ -32,13 +32,14 @@ import reborncore.api.IToolDrop;
|
|||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import reborncore.fluid.FluidStack;
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.api.generator.FluidGeneratorRecipe;
|
||||
import techreborn.api.generator.FluidGeneratorRecipeList;
|
||||
import techreborn.api.generator.GeneratorRecipeHelper;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import reborncore.client.containerBuilder.IContainerProvider;
|
|||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import reborncore.common.crafting.RebornIngredient;
|
||||
import reborncore.common.crafting.Recipe;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -71,7 +71,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
if (stack.isEmpty()) {
|
||||
return 0;
|
||||
} else {
|
||||
return FurnaceBlockEntity.getBurnTimes().getOrDefault(stack.getItem(), 0);
|
||||
return FurnaceBlockEntity.createFuelTimeMap().getOrDefault(stack.getItem(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
}
|
||||
}
|
||||
|
||||
public boolean hasAllInputs(final Recipe recipeType) {
|
||||
public boolean hasAllInputs(final RebornRecipe recipeType) {
|
||||
if (recipeType == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
return false;
|
||||
} else {
|
||||
ItemStack itemstack = null;
|
||||
for (final Recipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
|
||||
for (final RebornRecipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
itemstack = recipeType.getOutputs().get(0);
|
||||
break;
|
||||
|
@ -169,7 +169,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
public void smeltItem() {
|
||||
if (this.canSmelt()) {
|
||||
ItemStack itemstack = ItemStack.EMPTY;
|
||||
for (final Recipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
|
||||
for (final RebornRecipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
itemstack = recipeType.getOutputs().get(0);
|
||||
break;
|
||||
|
@ -185,7 +185,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
inventory.shrinkSlot(this.output, -itemstack.getAmount());
|
||||
}
|
||||
|
||||
for (final Recipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
|
||||
for (final RebornRecipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
|
||||
boolean hasAllRecipes = true;
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import techreborn.api.fluidreplicator.FluidReplicatorRecipeCrafter;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRTileEntities;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
|||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.config.ConfigRegistry;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.IInventoryAccess;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
|
@ -47,6 +46,7 @@ import techreborn.init.ModRecipes;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRTileEntities;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
|
|
@ -431,7 +431,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
|
||||
// ItemHandlerProvider
|
||||
@Override
|
||||
public IItemHandler getInventory() {
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ import techreborn.init.TRContent;
|
|||
import techreborn.init.TRTileEntities;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@RebornRegister(TechReborn.MOD_ID)
|
||||
public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop {
|
||||
|
@ -69,7 +70,7 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
boolean lastRedstone = redstone;
|
||||
redstone = false;
|
||||
if (canUseEnergy(euPerTick)) {
|
||||
Iterator<PlayerEntity> tIterator = super.world.playerEntities.iterator();
|
||||
Iterator<PlayerEntity> tIterator = super.world.getPlayers().iterator();
|
||||
while (tIterator.hasNext()) {
|
||||
PlayerEntity player = tIterator.next();
|
||||
if (player.squaredEnvTypeanceTo((double) super.getPos().getX() + 0.5D,
|
||||
|
|
|
@ -25,7 +25,11 @@
|
|||
package techreborn.utils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import reborncore.fluid.Fluid;
|
||||
import reborncore.fluid.FluidStack;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -44,4 +48,19 @@ public class FluidUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void drainContainers(Tank tank, Inventory<?> inventory, int i, int i1) {
|
||||
|
||||
}
|
||||
|
||||
public static void fillContainers(Tank tank, Inventory<?> inventory, int i, int i1, Fluid fluidType) {
|
||||
|
||||
}
|
||||
|
||||
public static boolean fluidEquals(Fluid fluid, Fluid fluid1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStackInContainer(ItemStack invStack) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue