it compiles :D

This commit is contained in:
modmuss50 2019-06-12 19:29:04 +01:00
parent 500ff29dbd
commit 6b9f6cb4f8
142 changed files with 755 additions and 1724 deletions

View file

@ -32,23 +32,15 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import reborncore.common.multiblock.MultiblockEventHandler;
import reborncore.common.multiblock.MultiblockServerTickHandler;
import reborncore.common.registration.RegistrationManager;
import reborncore.common.util.Torus;
import techreborn.api.TechRebornAPI;
import techreborn.config.ConfigTechReborn;
import techreborn.events.BlockBreakHandler;
import techreborn.events.TRRecipeHandler;
import techreborn.events.TRTickHandler;
import techreborn.init.*;
import techreborn.packets.ClientboundPackets;
import techreborn.packets.ServerboundPackets;
import techreborn.proxies.CommonProxy;
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.utils.BehaviorDispenseScrapbox;
import techreborn.utils.StackWIPHandler;
import techreborn.world.village.ModLootTables;
public class TechReborn implements ModInitializer {
@ -66,7 +58,6 @@ public class TechReborn implements ModInitializer {
@Override
public void onInitialize() {
MinecraftForge.EVENT_BUS.register(this);
INSTANCE = this;
RegistrationManager registrationManager = new RegistrationManager("techreborn");
@ -86,7 +77,7 @@ public class TechReborn implements ModInitializer {
// Registers Chest Loot
ModLoot.init();
MinecraftForge.EVENT_BUS.register(new ModLoot());
//MinecraftForge.EVENT_BUS.register(new ModLoot());
// Sounds
//TODO 1.13 registry events
//ModSounds.init();
@ -98,18 +89,18 @@ public class TechReborn implements ModInitializer {
// Register Gui Handler
//NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
// Event busses
MinecraftForge.EVENT_BUS.register(new StackWIPHandler());
MinecraftForge.EVENT_BUS.register(new BlockBreakHandler());
MinecraftForge.EVENT_BUS.register(new TRRecipeHandler());
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
MinecraftForge.EVENT_BUS.register(new MultiblockServerTickHandler());
MinecraftForge.EVENT_BUS.register(new TRTickHandler());
// MinecraftForge.EVENT_BUS.register(new StackWIPHandler());
// MinecraftForge.EVENT_BUS.register(new BlockBreakHandler());
// MinecraftForge.EVENT_BUS.register(new TRRecipeHandler());
// MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
// MinecraftForge.EVENT_BUS.register(new MultiblockServerTickHandler());
// MinecraftForge.EVENT_BUS.register(new TRTickHandler());
//Village stuff
if (ConfigTechReborn.enableRubberTreePlantation) {
VillagerRegistry.instance().registerVillageCreationHandler(new VillagePlantaionHandler());
//MapGenStructureIO.registerStructureComponent(VillageComponentRubberPlantaion.class, new ResourceLocation(MOD_ID, "rubberplantation").toString());
ModLootTables.CHESTS_RUBBER_PLANTATION.toString(); //Done to make it load, then it will be read from disk
}
// if (ConfigTechReborn.enableRubberTreePlantation) {
// VillagerRegistry.instance().registerVillageCreationHandler(new VillagePlantaionHandler());
// //MapGenStructureIO.registerStructureComponent(VillageComponentRubberPlantaion.class, new ResourceLocation(MOD_ID, "rubberplantation").toString());
// ModLootTables.CHESTS_RUBBER_PLANTATION.toString(); //Done to make it load, then it will be read from disk
// }
// Scrapbox
if (BehaviorDispenseScrapbox.dispenseScrapboxes) {

View file

@ -26,6 +26,7 @@ package techreborn.api;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import java.util.List;
public interface IC2Helper {

View file

@ -25,7 +25,6 @@
package techreborn.api.fluidreplicator;
import net.minecraft.util.math.BlockPos;
import reborncore.fluid.Fluid;
import techreborn.init.TRContent;
import techreborn.tiles.machine.multiblock.TileFluidReplicator;

View file

@ -26,11 +26,11 @@ package techreborn.api.fluidreplicator;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import reborncore.common.util.Tank;
import reborncore.fluid.Fluid;
import reborncore.fluid.FluidStack;
import techreborn.init.ModRecipes;
import techreborn.init.TRContent;
import techreborn.tiles.machine.multiblock.TileFluidReplicator;
@ -75,7 +75,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
}
private boolean canFit(Fluid fluid, Tank tank) {
if (tank.fill(new FluidStack(fluid, Fluid.BUCKET_VOLUME), false) != Fluid.BUCKET_VOLUME) {
if (tank.fill(new FluidStack(fluid, 1000), false) != 1000) {
return false;
}
return true;
@ -118,7 +118,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
// Checks to see if it can fit the output
// And fill tank with replicated fluid
if (canFit(currentRecipe.getFluid(), tileFluidReplicator.tank) && currentRecipe.onCraft(tileFluidReplicator)) {
tileFluidReplicator.tank.fill(new FluidStack(currentRecipe.getFluid(), Fluid.BUCKET_VOLUME), true);
tileFluidReplicator.tank.fill(new FluidStack(currentRecipe.getFluid(), 1000), true);
// This uses all the inputs
useAllInputs();
// Reset

View file

@ -24,9 +24,7 @@
package techreborn.api.fluidreplicator;
import org.apache.commons.lang3.Validate;
import reborncore.common.util.FluidUtils;
import reborncore.fluid.Fluid;
import techreborn.utils.FluidUtils;

View file

@ -25,8 +25,8 @@
package techreborn.api.generator;
import com.google.common.collect.Sets;
import reborncore.fluid.Fluid;
import techreborn.utils.FluidUtils;
import java.util.HashSet;
import java.util.Optional;

View file

@ -24,13 +24,13 @@
package techreborn.api.recipe;
import reborncore.common.crafting.Recipe;
import net.minecraft.block.entity.BlockEntity;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import techreborn.init.ModRecipes;
import java.util.List;
import net.minecraft.block.entity.BlockEntity;
/**
* @author drcrazy
@ -50,7 +50,7 @@ public class ScrapboxRecipeCrafter extends RecipeCrafter {
@Override
public void updateCurrentRecipe(){
List<Recipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(tile.getWorld());
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(tile.getWorld());
int random = tile.getWorld().random.nextInt(scrapboxRecipeList.size());
// Sets the current recipe then syncs
setCurrentRecipe(scrapboxRecipeList.get(random));

View file

@ -30,8 +30,6 @@ 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 RebornRecipe {

View file

@ -26,7 +26,6 @@ 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;

View file

@ -26,7 +26,6 @@ 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;

View file

@ -160,18 +160,10 @@ public class BlockAlarm extends BaseTileBlock {
return BlockRenderType.MODEL;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TranslatableComponent("techreborn.tooltip.alarm").applyFormat(ChatFormat.GRAY));
}
@Override
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos) {
return shape[getFacing(state).getId()];
}
}

View file

@ -33,7 +33,6 @@ 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;
import reborncore.api.ToolManager;
import reborncore.api.tile.IMachineGuiHandler;

View file

@ -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.Material;
@ -38,7 +39,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
public final int heatCapacity;
public BlockMachineCasing(int heatCapacity) {
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).sounds(BlockSoundGroup.METAL).build());
this.heatCapacity = heatCapacity;
}

View file

@ -24,7 +24,7 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.common.BaseBlock;
@ -32,6 +32,6 @@ import reborncore.common.BaseBlock;
public class BlockMachineFrame extends BaseBlock {
public BlockMachineFrame() {
super(Block.Settings.of(Material.METAL).strength(1f).sounds(BlockSoundGroup.METAL));
super(FabricBlockSettings.of(Material.METAL).strength(1f, 1f).sounds(BlockSoundGroup.METAL).build());
}
}

View file

@ -26,6 +26,7 @@ package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
@ -86,26 +87,26 @@ public class BlockNuke extends BaseBlock {
}
if (entityarrow.isOnFire()) {
ignite(worldIn, pos, state, shooter);
worldIn.removeBlock(pos);
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
}
}
}
@SuppressWarnings("deprecation")
@Override
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState) {
super.onBlockAdded(state, worldIn, pos, oldState);
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean b) {
super.onBlockAdded(state, worldIn, pos, oldState, b);
if (worldIn.isReceivingRedstonePower(pos)) {
ignite(worldIn, pos, state, null);
worldIn.removeBlock(pos);
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
}
}
@Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_) {
public void neighborUpdate(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_, boolean bo) {
if (worldIn.isReceivingRedstonePower(pos)) {
ignite(worldIn, pos, state, null);
worldIn.removeBlock(pos);
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
}
}

View file

@ -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.Material;
@ -68,37 +69,38 @@ public class BlockOre extends Block {
public static int sphaleriteMaxQuantity = 2;
public BlockOre() {
super(Block.Settings.of(Material.STONE).strength(2f));
super(FabricBlockSettings.of(Material.STONE).strength(2f, 2f).build());
}
@Override
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
Block ore = state.getBlock();
Random random = new Random();
// Secondary drop, like Yellow Garnet from Sphalerite ore added via event handler.
if (ore == TRContent.Ores.RUBY.block) {
OreDrop ruby = new OreDrop(TRContent.Gems.RUBY.getStack(rubyMinQuatity), rubyMaxQuantity);
drops.add(ruby.getDrops(fortune, random));
} else if (ore == TRContent.Ores.SAPPHIRE.block) {
OreDrop sapphire = new OreDrop(TRContent.Gems.SAPPHIRE.getStack(sapphireMinQuantity), sapphireMaxQuantity);
drops.add(sapphire.getDrops(fortune, random));
} else if (ore == TRContent.Ores.PYRITE.block) {
OreDrop pyriteDust = new OreDrop(TRContent.Dusts.PYRITE.getStack(pyriteMinQuatity), pyriteMaxQuantity);
drops.add(pyriteDust.getDrops(fortune, random));
} else if (ore == TRContent.Ores.SODALITE.block) {
OreDrop sodalite = new OreDrop(TRContent.Dusts.SODALITE.getStack(sodaliteMinQuatity), sodaliteMaxQuantity);
drops.add(sodalite.getDrops(fortune, random));
} else if (ore == TRContent.Ores.CINNABAR.block) {
OreDrop cinnabar = new OreDrop(TRContent.Dusts.CINNABAR.getStack(cinnabarMinQuatity), cinnabarMaxQuantity);
drops.add(cinnabar.getDrops(fortune, random));
} else if (ore == TRContent.Ores.SPHALERITE.block) {
OreDrop sphalerite = new OreDrop(TRContent.Dusts.SPHALERITE.getStack(sphaleriteMinQuatity), sphaleriteMaxQuantity);
drops.add(sphalerite.getDrops(fortune, random));
} else {
drops.add(new ItemStack(this));
}
return;
}
//TODO move to json
// @Override
// public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
// Block ore = state.getBlock();
// Random random = new Random();
//
// // Secondary drop, like Yellow Garnet from Sphalerite ore added via event handler.
// if (ore == TRContent.Ores.RUBY.block) {
// OreDrop ruby = new OreDrop(TRContent.Gems.RUBY.getStack(rubyMinQuatity), rubyMaxQuantity);
// drops.add(ruby.getDrops(fortune, random));
// } else if (ore == TRContent.Ores.SAPPHIRE.block) {
// OreDrop sapphire = new OreDrop(TRContent.Gems.SAPPHIRE.getStack(sapphireMinQuantity), sapphireMaxQuantity);
// drops.add(sapphire.getDrops(fortune, random));
// } else if (ore == TRContent.Ores.PYRITE.block) {
// OreDrop pyriteDust = new OreDrop(TRContent.Dusts.PYRITE.getStack(pyriteMinQuatity), pyriteMaxQuantity);
// drops.add(pyriteDust.getDrops(fortune, random));
// } else if (ore == TRContent.Ores.SODALITE.block) {
// OreDrop sodalite = new OreDrop(TRContent.Dusts.SODALITE.getStack(sodaliteMinQuatity), sodaliteMaxQuantity);
// drops.add(sodalite.getDrops(fortune, random));
// } else if (ore == TRContent.Ores.CINNABAR.block) {
// OreDrop cinnabar = new OreDrop(TRContent.Dusts.CINNABAR.getStack(cinnabarMinQuatity), cinnabarMaxQuantity);
// drops.add(cinnabar.getDrops(fortune, random));
// } else if (ore == TRContent.Ores.SPHALERITE.block) {
// OreDrop sphalerite = new OreDrop(TRContent.Dusts.SPHALERITE.getStack(sphaleriteMinQuatity), sphaleriteMaxQuantity);
// drops.add(sphalerite.getDrops(fortune, random));
// } else {
// drops.add(new ItemStack(this));
// }
//
// return;
// }
}

View file

@ -24,7 +24,7 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.FenceBlock;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
@ -33,6 +33,6 @@ import net.minecraft.sound.BlockSoundGroup;
public class BlockRefinedIronFence extends FenceBlock {
public BlockRefinedIronFence() {
super(Block.Settings.of(Material.METAL, MaterialColor.WOOD).strength(2.0F, 3.0F).sounds(BlockSoundGroup.METAL));
super(FabricBlockSettings.of(Material.METAL, MaterialColor.WOOD).strength(2.0F, 3.0F).sounds(BlockSoundGroup.METAL).build());
}
}

View file

@ -25,8 +25,6 @@
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;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
@ -34,8 +32,6 @@ import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import java.util.Random;
public class BlockReinforcedGlass extends GlassBlock {
public BlockReinforcedGlass() {

View file

@ -25,31 +25,21 @@
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;
import net.minecraft.block.FireBlock;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.Material;
import net.minecraft.item.ItemConvertible;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import techreborn.init.TRContent;
public class BlockRubberLeaves extends LeavesBlock {
public BlockRubberLeaves() {
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));
}
@Override
public ItemConvertible getItemDropped(BlockState state, World worldIn, BlockPos pos, int fortune) {
return TRContent.RUBBER_SAPLING;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, DISTANCE, PERSISTENT));
}
}

View file

@ -24,13 +24,8 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.LogBlock;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
@ -61,6 +56,7 @@ import techreborn.items.tool.ItemTreeTap;
import techreborn.items.tool.basic.ItemElectricTreetap;
import java.util.Random;
import java.util.function.Consumer;
/**
* Created by modmuss50 on 19/02/2016.
@ -71,7 +67,7 @@ public class BlockRubberLog extends LogBlock {
public static BooleanProperty HAS_SAP = BooleanProperty.create("hassap");
public BlockRubberLog() {
super(MaterialColor.SPRUCE, Block.Settings.of(Material.WOOD, MaterialColor.BROWN).strength(2.0F).sounds(BlockSoundGroup.WOOD).ticksRandomly());
super(MaterialColor.SPRUCE, FabricBlockSettings.of(Material.WOOD, MaterialColor.BROWN).strength(2.0F, 2f).sounds(BlockSoundGroup.WOOD).ticksRandomly().build());
this.setDefaultState(this.getDefaultState().with(SAP_SIDE, Direction.NORTH).with(HAS_SAP, false).with(AXIS, Direction.Axis.Y));
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 5, 5);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
@ -146,7 +142,7 @@ public class BlockRubberLog extends LogBlock {
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
} else {
playerIn.getStackInHand(Hand.MAIN_HAND).damageItem(1, playerIn);
playerIn.getStackInHand(Hand.MAIN_HAND).applyDamage(1, playerIn, playerEntity -> {});
}
if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) {
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(hitResult.getSide()));
@ -161,13 +157,13 @@ public class BlockRubberLog extends LogBlock {
return false;
}
@Override
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
drops.add(new ItemStack(this));
if (state.get(HAS_SAP)) {
if (new Random().nextInt(4) == 0) {
drops.add(TRContent.Parts.SAP.getStack());
}
}
}
// @Override
// public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
// drops.add(new ItemStack(this));
// if (state.get(HAS_SAP)) {
// if (new Random().nextInt(4) == 0) {
// drops.add(TRContent.Parts.SAP.getStack());
// }
// }
// }
}

View file

@ -24,6 +24,7 @@
package techreborn.blocks;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
@ -39,7 +40,7 @@ import techreborn.TechReborn;
public class BlockRubberPlank extends Block {
public BlockRubberPlank() {
super(Block.Settings.of(Material.WOOD).strength(2f).sounds(BlockSoundGroup.WOOD));
super(FabricBlockSettings.of(Material.WOOD).strength(2f, 2f).sounds(BlockSoundGroup.WOOD).build());
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 5, 20);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}

View file

@ -24,6 +24,7 @@
package techreborn.blocks;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
@ -36,7 +37,7 @@ import techreborn.TechReborn;
public class BlockRubberPlankSlab extends SlabBlock {
public BlockRubberPlankSlab() {
super(Block.Settings.of(Material.WOOD, MaterialColor.SPRUCE).strength(2.0F, 15.0F).sounds(BlockSoundGroup.WOOD));
super(FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE).strength(2.0F, 15.0F).sounds(BlockSoundGroup.WOOD).build());
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
}

View file

@ -24,7 +24,7 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material;
import net.minecraft.block.SaplingBlock;
import net.minecraft.sound.BlockSoundGroup;
@ -35,6 +35,6 @@ import net.minecraft.sound.BlockSoundGroup;
public class BlockRubberSapling extends SaplingBlock {
public BlockRubberSapling() {
super(new RubberTree(), Block.Settings.of(Material.PLANT).sounds(BlockSoundGroup.GRASS));
super(new RubberTree(), FabricBlockSettings.of(Material.PLANT).sounds(BlockSoundGroup.GRASS).build());
}
}

View file

@ -24,7 +24,7 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.common.BaseBlock;
@ -32,7 +32,7 @@ import reborncore.common.BaseBlock;
public class BlockStorage extends BaseBlock {
public BlockStorage() {
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).sounds(BlockSoundGroup.METAL).build());
}
// public static ItemStack getStorageBlockByName(String name, int count) {

View file

@ -1,43 +1,50 @@
/*
* 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 java.util.Random;
import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import techreborn.world.feature.RubberTreeFeature;
/**
* @author drcrazy
*
*/
public class RubberTree extends SaplingGenerator {
@Override
protected AbstractTreeFeature<DefaultFeatureConfig> createTreeFeature(Random random) {
return new RubberTreeFeature();
}
}
/*
* 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.sapling.SaplingGenerator;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import javax.annotation.Nullable;
import java.util.Random;
/**
* @author drcrazy
*
*/
public class RubberTree extends SaplingGenerator {
@Nullable
@Override
protected AbstractTreeFeature<DefaultFeatureConfig> createTreeFeature(Random random) {
return null;
}
// @Override
// protected AbstractTreeFeature<DefaultFeatureConfig> createTreeFeature(Random random) {
// return new RubberTreeFeature();
// }
}

View file

@ -24,11 +24,7 @@
package techreborn.blocks.cable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.Material;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;

View file

@ -1,37 +0,0 @@
/*
* 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.fluid;
import net.minecraft.util.Identifier;
public class TechRebornFluid extends Fluid {
public TechRebornFluid(String fluidName) {
super(fluidName,
new Identifier("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"),
new Identifier("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"));
//FluidRegistry.addBucketForFluid(this);
}
}

View file

@ -24,6 +24,9 @@
package techreborn.blocks.generator;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -38,11 +41,8 @@ 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;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -55,7 +55,7 @@ import java.util.List;
public class BlockFusionCoil extends Block {
public BlockFusionCoil() {
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).sounds(BlockSoundGroup.METAL).build());
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/generators"));
}
@ -65,7 +65,7 @@ public class BlockFusionCoil extends Block {
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(this);
dropStack(worldIn, pos, drop);

View file

@ -31,7 +31,6 @@ 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;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;

View file

@ -24,14 +24,11 @@
package techreborn.blocks.lighting;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
@ -55,6 +52,8 @@ import reborncore.common.util.WrenchUtils;
import techreborn.TechReborn;
import techreborn.tiles.lighting.TileLamp;
import javax.annotation.Nullable;
public class BlockLamp extends BaseTileBlock {
public static DirectionProperty FACING = Properties.FACING;

View file

@ -24,6 +24,7 @@
package techreborn.blocks.storage;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
@ -57,7 +58,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
public IMachineGuiHandler gui;
public BlockEnergyStorage(String name, IMachineGuiHandler gui) {
super(Block.Settings.of(Material.METAL).strength(2f));
super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).build());
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH));
this.name = name;
this.gui = gui;

View file

@ -24,6 +24,7 @@
package techreborn.blocks.storage;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
@ -35,7 +36,6 @@ 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;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
@ -55,7 +55,7 @@ import techreborn.tiles.storage.lesu.TileLSUStorage;
public class BlockLSUStorage extends BaseTileBlock {
public BlockLSUStorage() {
super(Block.Settings.of(Material.METAL).strength(2f));
super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).build());
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}

View file

@ -24,6 +24,8 @@
package techreborn.blocks.tier0;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
@ -35,8 +37,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;

View file

@ -154,11 +154,6 @@ public class BlockPlayerDetector extends BlockMachineBase {
builder.add(TYPE);
}
@Override
public boolean canConnectRedstone(BlockState state, BlockView world, BlockPos pos, @Nullable Direction side) {
return true;
}
@Override
public boolean emitsRedstonePower(BlockState state) {
return true;

View file

@ -32,7 +32,7 @@ import reborncore.client.models.RebornModelRegistry;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.TechReborn;
import techreborn.client.EGui;
import techreborn.tiles.machine.multiblock.TileEnvTypeillationTower;
import techreborn.tiles.machine.multiblock.TileDistillationTower;
public class BlockDistillationTower extends BlockMachineBase {
@ -43,7 +43,7 @@ public class BlockDistillationTower extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileEnvTypeillationTower();
return new TileDistillationTower();
}
@Override

View file

@ -24,6 +24,7 @@
package techreborn.blocks.transformers;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
@ -56,7 +57,7 @@ public abstract class BlockTransformer extends BaseTileBlock {
public String name;
public BlockTransformer(String name) {
super(Block.Settings.of(Material.METAL).strength(2f));
super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).build());
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH));
this.name = name;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));

View file

@ -24,23 +24,17 @@
package techreborn.client;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import techreborn.init.TRContent;
public class ClientEventHandler {
@SubscribeEvent
public static void renderPlayer(RenderPlayerEvent.Pre event) {
PlayerEntity player = event.getEntityPlayer();
Item chestslot = !player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()
? player.getEquippedStack(EquipmentSlot.CHEST).getItem() : null;
if (chestslot != null && chestslot == TRContent.CLOAKING_DEVICE) {
event.setCanceled(true);
}
}
//TODO 1.14
// @SubscribeEvent
// public static void renderPlayer(RenderPlayerEvent.Pre event) {
// PlayerEntity player = event.getEntityPlayer();
// Item chestslot = !player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()
// ? player.getEquippedStack(EquipmentSlot.CHEST).getItem() : null;
// if (chestslot != null && chestslot == TRContent.CLOAKING_DEVICE) {
// event.setCanceled(true);
// }
// }
}

View file

@ -24,53 +24,15 @@
package techreborn.client;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.ContainerScreen;
import net.minecraft.container.Container;
import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.containerBuilder.IContainerProvider;
import techreborn.client.container.ContainerDestructoPack;
import techreborn.tiles.*;
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.tiles.generator.*;
import techreborn.tiles.generator.advanced.TileDieselGenerator;
import techreborn.tiles.generator.advanced.TileGasTurbine;
import techreborn.tiles.generator.advanced.TileSemiFluidGenerator;
import techreborn.tiles.generator.advanced.TileThermalGenerator;
import techreborn.tiles.generator.basic.TileSolidFuelGenerator;
import techreborn.tiles.machine.iron.TileIronAlloyFurnace;
import techreborn.tiles.machine.iron.TileIronFurnace;
import techreborn.tiles.machine.multiblock.*;
import techreborn.tiles.machine.tier1.*;
import techreborn.tiles.machine.tier3.TileChunkLoader;
import techreborn.tiles.machine.tier3.TileMatterFabricator;
import techreborn.tiles.machine.tier3.TileQuantumChest;
import techreborn.tiles.machine.tier3.TileQuantumTank;
import techreborn.tiles.storage.TileAdjustableSU;
import techreborn.tiles.storage.TileHighVoltageSU;
import techreborn.tiles.storage.TileLowVoltageSU;
import techreborn.tiles.storage.TileMediumVoltageSU;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.function.Consumer;
import techreborn.client.gui.*;
import techreborn.tiles.storage.idsu.TileInterdimensionalSU;
import techreborn.tiles.storage.lesu.TileLapotronicSU;
import java.util.stream.Stream;
public enum EGui implements IMachineGuiHandler {
@ -120,111 +82,10 @@ public enum EGui implements IMachineGuiHandler {
private final boolean containerBuilder;
private EGui(final boolean containerBuilder) {
EGui(final boolean containerBuilder) {
this.containerBuilder = containerBuilder;
}
static {
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, ()-> EGui::getClientGuiElement);
}
public static ContainerScreen getClientGuiElement(FMLPlayMessages.OpenContainer msg) {
EGui gui = byID(msg.getId());
PlayerEntity player = MinecraftClient.getInstance().player;
BlockPos pos = msg.getAdditionalData().readBlockPos();
BlockEntity tile = player.world.getBlockEntity(pos);
switch (gui) {
case AESU:
return new GuiAESU(player, (TileAdjustableSU) tile);
case ALLOY_FURNACE:
return new GuiAlloyFurnace(player, (TileIronAlloyFurnace) tile);
case ALLOY_SMELTER:
return new GuiAlloySmelter(player, (TileAlloySmelter) tile);
case ASSEMBLING_MACHINE:
return new GuiAssemblingMachine(player, (TileAssemblingMachine) tile);
case LOW_VOLTAGE_SU:
return new GuiBatbox(player, (TileLowVoltageSU) tile);
case BLAST_FURNACE:
return new GuiBlastFurnace(player, (TileIndustrialBlastFurnace) tile);
case CENTRIFUGE:
return new GuiCentrifuge(player, (TileIndustrialCentrifuge) tile);
case CHARGEBENCH:
return new GuiChargeBench(player, (TileChargeOMat) tile);
case CHEMICAL_REACTOR:
return new GuiChemicalReactor(player, (TileChemicalReactor) tile);
case CHUNK_LOADER:
return new GuiChunkLoader(player, (TileChunkLoader) tile);
case COMPRESSOR:
return new GuiCompressor(player, (TileCompressor) tile);
case DESTRUCTOPACK:
return new GuiDestructoPack(new ContainerDestructoPack(player));
case DIESEL_GENERATOR:
return new GuiDieselGenerator(player, (TileDieselGenerator) tile);
case DIGITAL_CHEST:
return new GuiDigitalChest(player, (TileDigitalChest) tile);
case ELECTRIC_FURNACE:
return new GuiElectricFurnace(player, (TileElectricFurnace) tile);
case EXTRACTOR:
return new GuiExtractor(player, (TileExtractor) tile);
case FUSION_CONTROLLER:
return new GuiFusionReactor(player, (TileFusionControlComputer) tile);
case GAS_TURBINE:
return new GuiGasTurbine(player, (TileGasTurbine) tile);
case GENERATOR:
return new GuiGenerator(player, (TileSolidFuelGenerator) tile);
case GRINDER:
return new GuiGrinder(player, (TileGrinder) tile);
case IDSU:
return new GuiIDSU(player, (TileInterdimensionalSU) tile);
case IMPLOSION_COMPRESSOR:
return new GuiImplosionCompressor(player, (TileImplosionCompressor) tile);
case INDUSTRIAL_ELECTROLYZER:
return new GuiIndustrialElectrolyzer(player, (TileIndustrialElectrolyzer) tile);
case INDUSTRIAL_GRINDER:
return new GuiIndustrialGrinder(player, (TileIndustrialGrinder) tile);
case IRON_FURNACE:
return new GuiIronFurnace(player, (TileIronFurnace) tile);
case LESU:
return new GuiLESU(player, (TileLapotronicSU) tile);
case MATTER_FABRICATOR:
return new GuiMatterFabricator(player, (TileMatterFabricator) tile);
case MEDIUM_VOLTAGE_SU:
return new GuiMFE(player, (TileMediumVoltageSU) tile);
case HIGH_VOLTAGE_SU:
return new GuiMFSU(player, (TileHighVoltageSU) tile);
case QUANTUM_CHEST:
return new GuiQuantumChest(player, (TileQuantumChest) tile);
case QUANTUM_TANK:
return new GuiQuantumTank(player, (TileQuantumTank) tile);
case RECYCLER:
return new GuiRecycler(player, (TileRecycler) tile);
case ROLLING_MACHINE:
return new GuiRollingMachine(player, (TileRollingMachine) tile);
case SAWMILL:
return new GuiIndustrialSawmill(player, (TileIndustrialSawmill) tile);
case SCRAPBOXINATOR:
return new GuiScrapboxinator(player, (TileScrapboxinator) tile);
case SEMIFLUID_GENERATOR:
return new GuiSemifluidGenerator(player, (TileSemiFluidGenerator) tile);
case THERMAL_GENERATOR:
return new GuiThermalGenerator(player, (TileThermalGenerator) tile);
case VACUUM_FREEZER:
return new GuiVacuumFreezer(player, (TileVacuumFreezer) tile);
case AUTO_CRAFTING_TABLE:
return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile);
case PLASMA_GENERATOR:
return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile);
case EnvTypeILLATION_TOWER:
return new GuiEnvTypeillationTower(player, (TileEnvTypeillationTower) tile);
case FLUID_REPLICATOR:
return new GuiFluidReplicator(player, (TileFluidReplicator) tile);
default:
throw new RuntimeException("No gui found for " + msg.getId());
}
}
public static EGui byID(Identifier resourceLocation){
return Arrays.stream(values())
.filter(eGui -> eGui.name().toLowerCase().equals(resourceLocation.getPath()))
@ -232,41 +93,18 @@ public enum EGui implements IMachineGuiHandler {
.orElseThrow(() -> new RuntimeException("Failed to find gui for " + resourceLocation));
}
public static Stream<EGui> stream(){
return Arrays.stream(values());
}
public Identifier getID(){
return new Identifier("techreborn", name().toLowerCase());
}
@Override
public void open(PlayerEntity player, BlockPos pos, World world) {
if(!world.isClient){
EGui gui = this;
NetworkHooks.openGui((ServerPlayerEntity) player, new IInteractionObject() {
@Override
public Container createContainer(PlayerInventory playerInventory, PlayerEntity playerIn) {
BlockEntity tileEntity = playerIn.world.getBlockEntity(pos);
if (tileEntity instanceof IContainerProvider) {
return ((IContainerProvider) tileEntity).createContainer(player);
}
return null;
}
@Override
public String getGuiID() {
return "techreborn:" + gui.name().toLowerCase();
}
@Override
public Component getName() {
return new TextComponent(getGuiID());
}
@Override
public boolean hasCustomName() {
return false;
}
@Nullable
@Override
public Component getCustomName() {
return null;
}
}, packetBuffer -> packetBuffer.writeBlockPos(pos));
ContainerProviderRegistry.INSTANCE.openContainer(getID(), player, packetByteBuf -> packetByteBuf.writeBlockPos(pos));
}
}

View file

@ -24,15 +24,25 @@
package techreborn.client;
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry;
import net.fabricmc.fabric.api.container.ContainerFactory;
import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.gui.screen.ContainerScreenRegistry;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.container.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.PacketByteBuf;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.client.containerBuilder.IContainerProvider;
import techreborn.client.container.ContainerDestructoPack;
import techreborn.client.gui.*;
import techreborn.tiles.*;
import techreborn.tiles.TileChargeOMat;
import techreborn.tiles.TileDigitalChest;
import techreborn.tiles.TileIndustrialCentrifuge;
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.tiles.generator.TilePlasmaGenerator;
import techreborn.tiles.generator.advanced.TileDieselGenerator;
@ -55,32 +65,23 @@ import techreborn.tiles.storage.TileMediumVoltageSU;
import techreborn.tiles.storage.idsu.TileInterdimensionalSU;
import techreborn.tiles.storage.lesu.TileLapotronicSU;
public class GuiHandler implements IGuiHandler {
import java.util.Arrays;
import java.util.function.Consumer;
@Override
public Object getServerGuiElement(final int ID, final PlayerEntity player, final World world, final int x,
final int y, final int z) {
public class GuiHandler {
final EGui gui = EGui.values()[ID];
final BlockEntity tile = world.getBlockEntity(new BlockPos(x, y, z));
public static void register(){
if (gui.useContainerBuilder() && tile != null)
return ((IContainerProvider) tile).createContainer(player);
EGui.stream().forEach(gui -> ContainerProviderRegistry.INSTANCE.registerFactory(gui.getID(), (i, identifier, playerEntity, packetByteBuf) -> {
final BlockEntity tile = playerEntity.world.getBlockEntity(packetByteBuf.readBlockPos());
return ((IContainerProvider) tile).createContainer(playerEntity);
}));
switch (gui) {
case DESTRUCTOPACK:
return new ContainerDestructoPack(player);
default:
break;
}
return null;
EGui.stream().forEach(gui -> ScreenProviderRegistry.INSTANCE.registerFactory(gui.getID(), (i, identifier, playerEntity, packetByteBuf) -> getClientGuiElement(EGui.byID(identifier), playerEntity, packetByteBuf.readBlockPos())));
}
@Override
public Object getClientGuiElement(final int ID, final PlayerEntity player, final World world, final int x,
final int y, final int z) {
final EGui gui = EGui.values()[ID];
final BlockEntity tile = world.getBlockEntity(new BlockPos(x, y, z));
private static AbstractContainerScreen getClientGuiElement(final EGui gui, final PlayerEntity player, BlockPos pos) {
final BlockEntity tile = player.world.getBlockEntity(pos);
switch (gui) {
case AESU:
@ -164,9 +165,7 @@ public class GuiHandler implements IGuiHandler {
case PLASMA_GENERATOR:
return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile);
case EnvTypeILLATION_TOWER:
return new GuiEnvTypeillationTower(player, (TileEnvTypeillationTower) tile);
case MANUAL:
return new GuiManual(player);
return new GuiDistillationTower(player, (TileDistillationTower) tile);
case FLUID_REPLICATOR:
return new GuiFluidReplicator(player, (TileFluidReplicator) tile);
default:

View file

@ -27,6 +27,7 @@ package techreborn.client.container;
import net.minecraft.container.Slot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.TextComponent;
import reborncore.client.gui.slots.SlotFilteredVoid;
import reborncore.common.container.RebornContainer;
import reborncore.common.util.Inventory;
@ -38,7 +39,7 @@ public class ContainerDestructoPack extends RebornContainer {
private Inventory<?> inv;
public ContainerDestructoPack(PlayerEntity player) {
super(null);
super(null, new TextComponent("destructopack"));
this.player = player;
inv = new Inventory<>(1, "destructopack", 64, null);
buildContainer();

View file

@ -25,21 +25,21 @@
package techreborn.client.container.builder.slot;
import net.minecraft.block.entity.FurnaceBlockEntity;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import reborncore.client.gui.slots.BaseSlot;
public class FurnaceFuelSlot extends BaseSlot {
public FurnaceFuelSlot(IItemHandler inventoryIn, int index, int xPosition, int yPosition) {
public FurnaceFuelSlot(Inventory inventoryIn, int index, int xPosition, int yPosition) {
super(inventoryIn, index, xPosition, yPosition);
}
@Override
public boolean canInsert(ItemStack stack)
{
return FurnaceBlockEntity.isItemFuel(stack) || isBucket(stack);
return FurnaceBlockEntity.canUseAsFuel(stack) || isBucket(stack);
}
@Override

View file

@ -25,7 +25,7 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
@ -72,15 +72,13 @@ public class GuiAESU extends GuiBase {
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
buttons.add(new GuiButtonUpDown(300, 121, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(301, 121 + 12, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(302, 121 + 24, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(303, 121 + 36, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(121, 79, this, layer, this::onClick));
buttons.add(new GuiButtonUpDown(121 + 12, 79, this, layer, this::onClick));
buttons.add(new GuiButtonUpDown(121 + 24, 79, this, layer, this::onClick));
buttons.add(new GuiButtonUpDown(121 + 36, 79, this, layer, this::onClick));
}
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id >= 300 && button.id <= 303) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(button.id, tile));
}
public void onClick(ButtonWidget button){
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(1, tile));
}
}

View file

@ -28,6 +28,7 @@ import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Identifier;
import techreborn.tiles.machine.iron.TileIronAlloyFurnace;
@ -39,7 +40,7 @@ public class GuiAlloyFurnace extends AbstractContainerScreen {
TileIronAlloyFurnace alloyfurnace;
public GuiAlloyFurnace(final PlayerEntity player, final TileIronAlloyFurnace alloyFurnace) {
super(alloyFurnace.createContainer(player));
super(alloyFurnace.createContainer(player), player.inventory, new TextComponent("techreborn.alloy_furnace"));
this.containerWidth = 176;
this.containerHeight = 167;
this.alloyfurnace = alloyFurnace;
@ -47,7 +48,7 @@ public class GuiAlloyFurnace extends AbstractContainerScreen {
@Override
protected void drawBackground(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
this.drawDefaultBackground();
this.renderBackground();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(GuiAlloyFurnace.texture);
final int k = (this.width - this.containerWidth) / 2;

View file

@ -25,8 +25,8 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GuiLighting;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Recipe;
@ -54,21 +54,7 @@ public class GuiAutoCrafting extends GuiBase {
}
public void renderItemStack(ItemStack stack, int x, int y) {
if (stack != EMPTY) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GuiLighting.enableForItems();
itemRenderer.renderGuiItem(stack, x, y);
GlStateManager.disableLighting();
GlStateManager.pushMatrix();
GlStateManager.disableDepthTest();
GlStateManager.color4f(1, 1, 1, 1F / 3F);
drawRect(x - 4, y- 4, x + 20, y + 20, -2139062144);
GlStateManager.enableDepthTest();
GlStateManager.color4f(1F, 1F, 1F, 1F);
GlStateManager.enableBlend();
GlStateManager.popMatrix();
}
MinecraftClient.getInstance().getItemRenderer().renderGuiItem(stack, x, y);
}
@Override
@ -95,7 +81,7 @@ public class GuiAutoCrafting extends GuiBase {
}
drawOutputSlot(145, 42, layer);
drawOutputSlot(95, 42, layer);
draw("Inventory", 8, 82, 4210752, layer);
drawString("Inventory", 8, 82, 4210752, layer);
builder.drawLockButton(this, 145, 4, mouseX, mouseY, layer, tileAutoCraftingTable.locked);
}

View file

@ -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;

View file

@ -24,8 +24,8 @@
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;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -50,8 +50,8 @@ public class GuiBlastFurnace extends GuiBase {
}
@Override
public void initGui() {
super.initGui();
public void init() {
super.init();
this.hasMultiBlock = this.tile.getCachedHeat() != 0;
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
@ -96,7 +96,7 @@ public class GuiBlastFurnace extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -25,12 +25,11 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.gui.ContainerScreen;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Identifier;
import reborncore.client.gui.builder.widget.GuiButtonSimple;
import techreborn.tiles.machine.tier3.TileChunkLoader;
@ -46,7 +45,7 @@ public class GuiChunkLoader extends AbstractContainerScreen {
private ButtonWidget minusTenButton;
public GuiChunkLoader(final PlayerEntity player, final TileChunkLoader chunkLoader) {
super(chunkLoader.createContainer(player));
super(chunkLoader.createContainer(player), player.inventory, new TextComponent("techreborn.chunkloader"));
this.containerWidth = 176;
this.containerHeight = 167;
this.chunkloader = chunkLoader;
@ -57,11 +56,11 @@ public class GuiChunkLoader extends AbstractContainerScreen {
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");
this.plusTenButton = new GuiButtonSimple(0, this.left + 45, this.top + 37, 40, 20, "+10");
this.plusOneButton = new GuiButtonSimple(this.left + 5, this.top + 37, 40, 20, "+1", buttonWidget -> {});
this.plusTenButton = new GuiButtonSimple(this.left + 45, this.top + 37, 40, 20, "+10", buttonWidget -> {});
this.minusOneButton = new GuiButtonSimple(0, this.left + 90, this.top + 37, 40, 20, "-1");
this.minusTenButton = new GuiButtonSimple(0, this.left + 130, this.top + 37, 40, 20, "-10");
this.minusOneButton = new GuiButtonSimple(this.left + 90, this.top + 37, 40, 20, "-1", buttonWidget -> {});
this.minusTenButton = new GuiButtonSimple(this.left + 130, this.top + 37, 40, 20, "-10", buttonWidget -> {});
this.buttons.add(this.plusOneButton);
this.buttons.add(this.plusTenButton);
@ -71,7 +70,7 @@ public class GuiChunkLoader extends AbstractContainerScreen {
@Override
protected void drawBackground(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
this.drawDefaultBackground();
this.renderBackground();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
minecraft.getTextureManager().bindTexture(GuiChunkLoader.texture);
final int k = (this.width - this.containerWidth) / 2;

View file

@ -24,11 +24,12 @@
package techreborn.client.gui;
import net.minecraft.client.gui.ContainerScreen;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.container.Container;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Identifier;
public class GuiDestructoPack extends AbstractContainerScreen {
@ -37,16 +38,16 @@ public class GuiDestructoPack extends AbstractContainerScreen {
"textures/gui/destructopack.png");
public GuiDestructoPack(Container container) {
super(container);
super(container, MinecraftClient.getInstance().player.inventory, new TextComponent("techreborn.destructopack"));
this.containerWidth = 176;
this.containerHeight = 166;
}
@Override
protected void drawBackground(float arg0, int arg1, int arg2) {
this.drawDefaultBackground();
this.renderBackground();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
this.minecraft.getTextureManager().bindTexture(texture);
blit(left, top, 0, 0, 176, 166);
}

View file

@ -24,9 +24,9 @@
package techreborn.client.gui;
import net.minecraft.entity.player.PlayerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder;
import techreborn.tiles.generator.advanced.TileDieselGenerator;

View file

@ -26,7 +26,6 @@ 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;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -38,20 +37,20 @@ import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
import reborncore.client.multiblock.MultiblockSet;
import techreborn.init.TRContent;
import techreborn.tiles.machine.multiblock.TileEnvTypeillationTower;
import techreborn.tiles.machine.multiblock.TileDistillationTower;
public class GuiEnvTypeillationTower extends GuiBase {
public class GuiDistillationTower extends GuiBase {
public TileEnvTypeillationTower tile;
public TileDistillationTower tile;
public GuiEnvTypeillationTower(final PlayerEntity player, final TileEnvTypeillationTower tile) {
public GuiDistillationTower(final PlayerEntity player, final TileDistillationTower tile) {
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
public void initGui() {
super.initGui();
public void init() {
super.init();
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
@ -91,7 +90,7 @@ public class GuiEnvTypeillationTower extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -100,7 +100,7 @@ public class GuiFluidReplicator extends GuiBase {
// GuiScreen
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -25,6 +25,7 @@
package techreborn.client.gui;
import net.minecraft.block.BlockState;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.tuple.Pair;
@ -79,14 +80,14 @@ public class GuiFusionReactor extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
if (tile.getCoilStatus() > 0) {
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
addHologramButton(6, 4, 212, layer).clickHandler(this::hologramToggle);
drawCentredString(tile.getStateString(), 20, Color.BLUE.darker().getRGB(), layer);
if(tile.state == 2){
drawCentredString( PowerSystem.getLocaliszedPowerFormatted((int) tile.getPowerChange()) + "/t", 30, Color.GREEN.darker().getRGB(), layer);
}
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
addHologramButton(76, 56, 212, layer).clickHandler(this::hologramToggle);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
Optional<Pair<Integer, Integer>> stackSize = getCoilStackCount();
@ -103,31 +104,22 @@ public class GuiFusionReactor extends GuiBase {
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));
buttons.add(new GuiButtonUpDown(302, 121 + 24, 79, this, GuiBase.Layer.FOREGROUND));
buttons.add(new GuiButtonUpDown(303, 121 + 36, 79, this, GuiBase.Layer.FOREGROUND));
buttons.add(new GuiButtonUpDown(121, 79, this, GuiBase.Layer.FOREGROUND, (ButtonWidget buttonWidget) -> sendSizeChange(5)));
buttons.add(new GuiButtonUpDown(121 + 12, 79, this, GuiBase.Layer.FOREGROUND, (ButtonWidget buttonWidget) -> sendSizeChange(1)));
buttons.add(new GuiButtonUpDown(121 + 24, 79, this, GuiBase.Layer.FOREGROUND, (ButtonWidget buttonWidget) -> sendSizeChange(-5)));
buttons.add(new GuiButtonUpDown(121 + 36, 79, this, GuiBase.Layer.FOREGROUND, (ButtonWidget buttonWidget) -> sendSizeChange(-1)));
builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
public void hologramToggle(GuiButtonExtended button, double x, double y){
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
updateMultiBlockRender();
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
}
if (button.id == 300){
sendSizeChange(5);
} else if (button.id == 301){
sendSizeChange(1);
} else if (button.id == 302){
sendSizeChange(-1);
} else if (button.id == 303){
sendSizeChange(-5);
}
}
private void sendSizeChange(int sizeDelta){

View file

@ -26,7 +26,6 @@ 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;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
@ -93,7 +92,7 @@ public class GuiImplosionCompressor extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -96,8 +96,8 @@ public class GuiIndustrialGrinder extends GuiBase {
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
public void onClick(GuiButtonExtended button, double mouseX, double mouseY){
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -49,8 +49,8 @@ public class GuiIndustrialSawmill extends GuiBase {
}
@Override
public void initGui() {
super.initGui();
public void init() {
super.init();
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
@ -96,7 +96,7 @@ public class GuiIndustrialSawmill extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -25,7 +25,6 @@
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;
import net.minecraft.item.ItemStack;
@ -50,7 +49,7 @@ public class GuiIronFurnace extends GuiBase {
@Override
protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
drawDefaultBackground();
renderBackground();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
builder.drawSlotTab(this, left - 24, top + 6, new ItemStack(TRContent.WRENCH));
minecraft.getTextureManager().bindTexture(GuiIronFurnace.texture);

View file

@ -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;

View file

@ -24,18 +24,12 @@
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.network.chat.TextComponent;
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.*;
public class GuiManual extends Screen {
@ -51,27 +45,23 @@ public class GuiManual extends Screen {
private static final String text3 = I18n.translate("techreborn.manual.refund");
public GuiManual(PlayerEntity player) {
super(new TextComponent("gui.manual"));
this.player = player;
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
@Override
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")));
if(ItemManual.allowRefund){
buttons.add(new GuiButtonExtended(3, (width / 2 - 30), y + 110, 60, 20, I18n.translate("techreborn.manual.refundbtn")));
}
// buttons.add(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, I18n.translate("techreborn.manual.wikibtn")));
// buttons.add(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, I18n.translate("techreborn.manual.discordbtn")));
// if(ItemManual.allowRefund){
// buttons.add(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, I18n.translate("techreborn.manual.refundbtn")));
// }
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
renderBackground();
minecraft.getTextureManager().bindTexture(GuiManual.texture);
int centerX = (width / 2) - guiWidth / 2;
int centerY = (height / 2) - guiHeight / 2;
@ -79,54 +69,55 @@ public class GuiManual extends Screen {
int y = height / 4;
font.draw(text1, ((width / 2) - font.getStringWidth(text1) / 2), height / 2 - (guiHeight / 4), 4210752);
font.draw(text2, ((width / 2) - font.getStringWidth(text2) / 2), height / 2 + 5, 4210752);
if(ItemManual.allowRefund){
if (ItemManual.allowRefund) {
font.draw(text3, ((width / 2) - font.getStringWidth(text3) / 2), y + 100, 4210752);
}
super.render(mouseX, mouseY, partialTicks);
}
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
switch (button.id) {
case 1:
minecraft.openScreen(new ConfirmChatLinkScreen(this, "http://wiki.techreborn.ovh", 1, false));
break;
case 2:
this.minecraft.openScreen(new ConfirmChatLinkScreen(this, "https://discord.gg/teamreborn", 2, false));
break;
case 3:
minecraft.openScreen(null);
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
break;
}
}
@Override
public void confirmResult(boolean result, int id) {
switch(id) {
case 1:
if(result == true) {
try {
Desktop.getDesktop().browse(new java.net.URI("http://wiki.techreborn.ovh"));
} catch (Exception e) {
System.err.print(e);
}
}else {
minecraft.openScreen(this);
}
break;
case 2:
if(result == true) {
try {
Desktop.getDesktop().browse(new java.net.URI("https://discord.gg/teamreborn"));
} catch (Exception e) {
System.err.print(e);
}
}else {
minecraft.openScreen(this);
}
break;
}
}
}
// public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
// switch (button.id) {
// case 1:
// minecraft.openScreen(new ConfirmChatLinkScreen(this, "http://wiki.techreborn.ovh", 1, false));
// break;
// case 2:
// this.minecraft.openScreen(new ConfirmChatLinkScreen(this, "https://discord.gg/teamreborn", 2, false));
// break;
// case 3:
// minecraft.openScreen(null);
// NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
// break;
// }
// }
//
// @Override
// public void confirmResult(boolean result, int id) {
// switch(id) {
// case 1:
// if(result == true) {
// try {
// Desktop.getDesktop().browse(new java.net.URI("http://wiki.techreborn.ovh"));
// } catch (Exception e) {
// System.err.print(e);
// }
// }else {
// minecraft.openScreen(this);
// }
// break;
// case 2:
// if(result == true) {
// try {
// Desktop.getDesktop().browse(new java.net.URI("https://discord.gg/teamreborn"));
// } catch (Exception e) {
// System.err.print(e);
// }
// }else {
// minecraft.openScreen(this);
// }
// break;
// }
// }
// }

View file

@ -24,9 +24,9 @@
package techreborn.client.gui;
import net.minecraft.entity.player.PlayerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder;
import techreborn.tiles.generator.TilePlasmaGenerator;

View file

@ -25,8 +25,8 @@
package techreborn.client.gui;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.fluid.FluidStack;
import techreborn.tiles.machine.tier3.TileQuantumTank;
public class GuiQuantumTank extends GuiBase {

View file

@ -88,7 +88,7 @@ public class GuiVacuumFreezer extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -1,35 +0,0 @@
/*
* 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.client.particle;
import net.minecraft.client.particle.FireSmokeLargeParticle;
import net.minecraft.world.World;
public class ParticleSmoke extends FireSmokeLargeParticle {
public ParticleSmoke(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1201_8_, double p_i1201_10_, double p_i1201_12_) {
super(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i1201_8_, p_i1201_10_, p_i1201_12_);
}
}

View file

@ -25,13 +25,13 @@
package techreborn.client.render;
import com.google.common.base.Charsets;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.resource.Resource;
import net.minecraft.util.Identifier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import techreborn.TechReborn;
import java.io.BufferedReader;

View file

@ -29,7 +29,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.block.BlockRenderManager;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
@ -37,6 +36,8 @@ import techreborn.blocks.BlockNuke;
import techreborn.entities.EntityNukePrimed;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
/**
* Created by Mark on 13/03/2016.
*/
@ -47,8 +48,14 @@ public class RenderNukePrimed extends EntityRenderer<EntityNukePrimed> {
this.field_4673 = 0.5F;
}
@Nullable
@Override
public void doRender(EntityNukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) {
protected Identifier getTexture(EntityNukePrimed entityNukePrimed) {
return SpriteAtlasTexture.BLOCK_ATLAS_TEX;
}
@Override
public void render(EntityNukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) {
BlockRenderManager blockrendererdispatcher = MinecraftClient.getInstance().getBlockRenderManager();
GlStateManager.pushMatrix();
GlStateManager.translatef((float) x, (float) y + 0.5F, (float) z);
@ -84,8 +91,4 @@ public class RenderNukePrimed extends EntityRenderer<EntityNukePrimed> {
super.render(entity, x, y, z, entityYaw, partialTicks);
}
@Override
protected Identifier getEntityTexture(EntityNukePrimed entity) {
return SpriteAtlasTexture.BLOCK_ATLAS_TEX;
}
}

View file

@ -24,6 +24,7 @@
package techreborn.entities;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.PrimedTntEntity;
@ -51,8 +52,8 @@ public class EntityNukePrimed extends PrimedTntEntity {
@ConfigRegistry(config = "misc", category = "nuke", key = "enabled", comment = "Should the nuke explode, set to false to prevent block damage")
public static boolean enabled = true;
public EntityNukePrimed(World world) {
super(world);
public EntityNukePrimed(EntityType<EntityNukePrimed> entityType, World world) {
super(entityType, world);
setFuse(EntityNukePrimed.fuseTime);
}

View file

@ -24,24 +24,9 @@
package techreborn.events;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.OreDrop;
import techreborn.TechReborn;
import techreborn.init.TRContent;
import java.util.List;
import java.util.Random;
@RebornRegister(TechReborn.MOD_ID)
public class BlockBreakHandler {
@ -59,51 +44,52 @@ public class BlockBreakHandler {
@ConfigRegistry(config = "misc", category = "blocks", key = "yellowGarnetDropChance", comment = "Chance to get Yellow Garnet gem from Sphalerite Ore")
public static double yellowGarnetDropChance = 0.125;
@SubscribeEvent
public void onBlockHarvest(BlockEvent.HarvestDropsEvent event) {
if (secondaryGemDrops && !event.isSilkTouching()) {
BlockState state = event.getState();
List<ItemStack> drops = event.getDrops();
Random random = new Random();
//TODO: fix tags
if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "ruby_ore")))) {
OreDrop redGarnet = new OreDrop(TRContent.Gems.RED_GARNET.getStack(), redGarnetDropChance, 1);
drops.add(redGarnet.getDrops(event.getFortuneLevel(), random));
}
else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sapphire_ore")))) {
OreDrop peridot = new OreDrop(TRContent.Gems.PERIDOT.getStack(), peridotDropChance, 1);
drops.add(peridot.getDrops(event.getFortuneLevel(), random));
}
else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sodalite_ore")))) {
OreDrop aluminium = new OreDrop(TRContent.Dusts.ALUMINUM.getStack(), aluminiumDropChance, 1);
drops.add(aluminium.getDrops(event.getFortuneLevel(), random));
}
else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "cinnabar_ore")))) {
OreDrop redstone = new OreDrop(new ItemStack(Items.REDSTONE), redstoneDropChance, 1);
drops.add(redstone.getDrops(event.getFortuneLevel(), random));
}
else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sphalerite_ore")))) {
OreDrop yellowGarnet = new OreDrop(TRContent.Gems.YELLOW_GARNET.getStack(), yellowGarnetDropChance, 1);
drops.add(yellowGarnet.getDrops(event.getFortuneLevel(), random));
}
}
}
@SubscribeEvent
public void getBreakSpeedEvent(PlayerEvent.BreakSpeed event){
if(event.getEntityPlayer().getHeldItem(Hand.MAIN_HAND).getItem() == TRContent.INDUSTRIAL_CHAINSAW && event.getOriginalSpeed() > 1.0f){
BlockPos pos = event.getPos();
World worldIn = event.getEntityPlayer().world;
float speed = 20F;
int blocks = 0;
for (int i = 1; i < 10; i++) {
BlockPos nextPos = pos.up(i);
BlockState nextState = worldIn.getBlockState(nextPos);
if(nextState.getBlock().matches(BlockTags.LOGS)){
blocks ++;
}
}
event.setNewSpeed(speed / blocks);
}
}
//TODO 1.14
// @SubscribeEvent
// public void onBlockHarvest(BlockEvent.HarvestDropsEvent event) {
// if (secondaryGemDrops && !event.isSilkTouching()) {
// BlockState state = event.getState();
// List<ItemStack> drops = event.getDrops();
// Random random = new Random();
// //TODO: fix tags
// if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "ruby_ore")))) {
// OreDrop redGarnet = new OreDrop(TRContent.Gems.RED_GARNET.getStack(), redGarnetDropChance, 1);
// drops.add(redGarnet.getDrops(event.getFortuneLevel(), random));
// }
// else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sapphire_ore")))) {
// OreDrop peridot = new OreDrop(TRContent.Gems.PERIDOT.getStack(), peridotDropChance, 1);
// drops.add(peridot.getDrops(event.getFortuneLevel(), random));
// }
// else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sodalite_ore")))) {
// OreDrop aluminium = new OreDrop(TRContent.Dusts.ALUMINUM.getStack(), aluminiumDropChance, 1);
// drops.add(aluminium.getDrops(event.getFortuneLevel(), random));
// }
// else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "cinnabar_ore")))) {
// OreDrop redstone = new OreDrop(new ItemStack(Items.REDSTONE), redstoneDropChance, 1);
// drops.add(redstone.getDrops(event.getFortuneLevel(), random));
// }
// else if (state.getBlock().matches(new BlockTags.CachingTag(new Identifier(TechReborn.MOD_ID, "sphalerite_ore")))) {
// OreDrop yellowGarnet = new OreDrop(TRContent.Gems.YELLOW_GARNET.getStack(), yellowGarnetDropChance, 1);
// drops.add(yellowGarnet.getDrops(event.getFortuneLevel(), random));
// }
// }
// }
//
// @SubscribeEvent
// public void getBreakSpeedEvent(PlayerEvent.BreakSpeed event){
// if(event.getEntityPlayer().getHeldItem(Hand.MAIN_HAND).getItem() == TRContent.INDUSTRIAL_CHAINSAW && event.getOriginalSpeed() > 1.0f){
// BlockPos pos = event.getPos();
// World worldIn = event.getEntityPlayer().world;
// float speed = 20F;
// int blocks = 0;
// for (int i = 1; i < 10; i++) {
// BlockPos nextPos = pos.up(i);
// BlockState nextState = worldIn.getBlockState(nextPos);
// if(nextState.getBlock().matches(BlockTags.LOGS)){
// blocks ++;
// }
// }
// event.setNewSpeed(speed / blocks);
// }
// }
}

View file

@ -24,13 +24,10 @@
package techreborn.events;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
@ -263,7 +260,7 @@ public class ModelRegistryEventHandler {
*/
private static void register(Item item, String modelPath) {
RebornModelRegistry.registerItemModel(item, modelPath);
//RebornModelRegistry.registerItemModel(item, modelPath);
}
private static void registerBlockstateMultiItem(Identifier RL, Item item, String variantName) {

View file

@ -24,60 +24,6 @@
package techreborn.events;
import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import reborncore.RebornRegistry;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.util.BucketHandler;
import techreborn.TechReborn;
import techreborn.blocks.*;
import techreborn.config.ConfigTechReborn;
import techreborn.entities.EntityNukePrimed;
import techreborn.init.TRArmorMaterial;
import techreborn.init.TRContent;
import techreborn.init.TRContent.*;
import techreborn.init.TRTileEntities;
import techreborn.init.TRToolTier;
import techreborn.itemblocks.ItemBlockRubberSapling;
import techreborn.items.DynamicCell;
import techreborn.items.ItemFrequencyTransmitter;
import techreborn.items.ItemManual;
import techreborn.items.ItemScrapBox;
import techreborn.items.armor.ItemCloakingDevice;
import techreborn.items.armor.ItemLapotronicOrbpack;
import techreborn.items.armor.ItemLithiumIonBatpack;
import techreborn.items.armor.ItemTRArmour;
import techreborn.items.battery.*;
import techreborn.items.tool.ItemDebugTool;
import techreborn.items.tool.ItemTreeTap;
import techreborn.items.tool.ItemWrench;
import techreborn.items.tool.advanced.ItemAdvancedChainsaw;
import techreborn.items.tool.advanced.ItemAdvancedDrill;
import techreborn.items.tool.advanced.ItemAdvancedJackhammer;
import techreborn.items.tool.advanced.ItemRockCutter;
import techreborn.items.tool.basic.ItemBasicChainsaw;
import techreborn.items.tool.basic.ItemBasicDrill;
import techreborn.items.tool.basic.ItemBasicJackhammer;
import techreborn.items.tool.basic.ItemElectricTreetap;
import techreborn.items.tool.industrial.*;
import techreborn.items.tool.vanilla.ItemTRAxe;
import techreborn.items.tool.vanilla.ItemTRHoe;
import techreborn.items.tool.vanilla.ItemTRPickaxe;
import techreborn.items.tool.vanilla.ItemTRSpade;
import techreborn.items.tool.vanilla.ItemTRSword;
import techreborn.utils.InitUtils;
import java.util.Arrays;
/**
* @author drcrazy
*

View file

@ -24,89 +24,67 @@
package techreborn.events;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.InputUtil;
import net.minecraft.item.Item;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.lwjgl.glfw.GLFW;
import reborncore.api.IListInfoProvider;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.RebornCoreConfig;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.ItemPowerManager;
import reborncore.common.util.StringUtils;
import techreborn.TechReborn;
public class StackToolTipEvent {
@SuppressWarnings("deprecation")
@Environment(EnvType.CLIENT)
@SubscribeEvent
public void handleItemTooltipEvent(ItemTooltipEvent event) {
if (event.getEntityPlayer() == null) {
return;
}
Item item = event.getItemStack().getItem();
if (item instanceof IListInfoProvider) {
((IListInfoProvider) item).addInfo(event.getToolTip(), false, false);
} else if (event.getItemStack().getItem() instanceof IEnergyItemInfo) {
IEnergyStorage capEnergy = new ItemPowerManager(event.getItemStack());
TextComponent line1 = new TextComponent(PowerSystem
.getLocaliszedPowerFormattedNoSuffix(capEnergy.getEnergyStored() / RebornCoreConfig.euPerFU));
line1.append("/");
line1.append(PowerSystem
.getLocaliszedPowerFormattedNoSuffix(capEnergy.getMaxEnergyStored() / RebornCoreConfig.euPerFU));
line1.append(" ");
line1.append(PowerSystem.getDisplayPower().abbreviation);
line1.applyFormat(ChatFormat.GOLD);
event.getToolTip().add(1, line1);
if (InputUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)
|| InputUtil.isKeyDown(GLFW.GLFW_KEY_RIGHT_SHIFT)) {
int percentage = percentage(capEnergy.getMaxEnergyStored(), capEnergy.getEnergyStored());
ChatFormat color = StringUtils.getPercentageColour(percentage);
event.getToolTip().add(2,
new TextComponent(color + "" + percentage + "%" + ChatFormat.GRAY + " Charged"));
// TODO: show both input and output rates
event.getToolTip().add(3, new TextComponent(ChatFormat.GRAY + "I/O Rate: "
+ ChatFormat.GOLD
+ PowerSystem.getLocaliszedPowerFormatted((int) ((IEnergyItemInfo) item).getMaxInput())));
}
} else {
try {
Block block = Block.getBlockFromItem(item);
if (block != null && (block instanceof BlockWithEntity || block instanceof BlockEntityProvider)
&& block.getRegistryName().getNamespace().contains("techreborn")) {
BlockEntity tile = block.createTileEntity(block.getDefaultState(), MinecraftClient.getInstance().world);
boolean hasData = false;
if (event.getItemStack().hasTag() && event.getItemStack().getTag().contains("tile_data")) {
CompoundTag tileData = event.getItemStack().getTag().getCompound("tile_data");
tile.fromTag(tileData);
hasData = true;
event.getToolTip()
.add(new TextComponent("Block data contained").applyFormat(ChatFormat.DARK_GREEN));
}
if (tile instanceof IListInfoProvider) {
((IListInfoProvider) tile).addInfo(event.getToolTip(), false, hasData);
}
}
} catch (NullPointerException e) {
TechReborn.LOGGER.debug("Failed to load info for " + event.getItemStack().getDisplayName());
}
}
}
// public void handleItemTooltipEvent(ItemTooltipEvent event) {
// if (event.getEntityPlayer() == null) {
// return;
// }
// Item item = event.getItemStack().getItem();
// if (item instanceof IListInfoProvider) {
// ((IListInfoProvider) item).addInfo(event.getToolTip(), false, false);
// } else if (event.getItemStack().getItem() instanceof IEnergyItemInfo) {
// IEnergyStorage capEnergy = new ItemPowerManager(event.getItemStack());
// TextComponent line1 = new TextComponent(PowerSystem
// .getLocaliszedPowerFormattedNoSuffix(capEnergy.getEnergyStored() / RebornCoreConfig.euPerFU));
// line1.append("/");
// line1.append(PowerSystem
// .getLocaliszedPowerFormattedNoSuffix(capEnergy.getMaxEnergyStored() / RebornCoreConfig.euPerFU));
// line1.append(" ");
// line1.append(PowerSystem.getDisplayPower().abbreviation);
// line1.applyFormat(ChatFormat.GOLD);
//
// event.getToolTip().add(1, line1);
//
// if (InputUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)
// || InputUtil.isKeyDown(GLFW.GLFW_KEY_RIGHT_SHIFT)) {
// int percentage = percentage(capEnergy.getMaxEnergyStored(), capEnergy.getEnergyStored());
// ChatFormat color = StringUtils.getPercentageColour(percentage);
// event.getToolTip().add(2,
// new TextComponent(color + "" + percentage + "%" + ChatFormat.GRAY + " Charged"));
//// TODO: show both input and output rates
// event.getToolTip().add(3, new TextComponent(ChatFormat.GRAY + "I/O Rate: "
// + ChatFormat.GOLD
// + PowerSystem.getLocaliszedPowerFormatted((int) ((IEnergyItemInfo) item).getMaxInput())));
// }
// } else {
// try {
// Block block = Block.getBlockFromItem(item);
// if (block != null && (block instanceof BlockWithEntity || block instanceof BlockEntityProvider)
// && block.getRegistryName().getNamespace().contains("techreborn")) {
// BlockEntity tile = block.createTileEntity(block.getDefaultState(), MinecraftClient.getInstance().world);
// boolean hasData = false;
// if (event.getItemStack().hasTag() && event.getItemStack().getTag().contains("tile_data")) {
// CompoundTag tileData = event.getItemStack().getTag().getCompound("tile_data");
// tile.fromTag(tileData);
// hasData = true;
// event.getToolTip()
// .add(new TextComponent("Block data contained").applyFormat(ChatFormat.DARK_GREEN));
// }
// if (tile instanceof IListInfoProvider) {
// ((IListInfoProvider) tile).addInfo(event.getToolTip(), false, hasData);
// }
// }
// } catch (NullPointerException e) {
// TechReborn.LOGGER.debug("Failed to load info for " + event.getItemStack().getDisplayName());
// }
// }
// }
public int percentage(int MaxValue, int CurrentValue) {
if (CurrentValue == 0)

View file

@ -27,52 +27,24 @@ package techreborn.events;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.world.World;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.init.TRContent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class TRRecipeHandler {
@SuppressWarnings("rawtypes")
private static List<IForgeRegistryEntry> hiddenEntrys = new ArrayList<>();
public static void hideEntry(IForgeRegistryEntry<?> entry) {
hiddenEntrys.add(entry);
}
@SubscribeEvent
public void pickupEvent(EntityItemPickupEvent entityItemPickupEvent) {
if(entityItemPickupEvent.getEntityPlayer() instanceof FakePlayer){
return;
}
World world = entityItemPickupEvent.getItem().world;
if (entityItemPickupEvent.getEntityPlayer() instanceof ServerPlayerEntity) {
if (ItemUtils.isInputEqual("logWood", entityItemPickupEvent.getItem().getItem(), false, true)) {
for (Recipe recipe : world.getRecipeManager().getRecipes()) {
if (recipe.getOutput().getItem() == TRContent.TREE_TAP) {
entityItemPickupEvent.getEntityPlayer().unlockRecipes(Collections.singletonList(recipe));
}
}
}
}
}
public static void unlockTRRecipes(ServerPlayerEntity playerMP) {
List<Recipe> recipeList = new ArrayList<>();
for (Recipe recipe : getRecipes(playerMP.world, VanillaRecipeTypes.CRAFTING)) {
List<Recipe<?>> recipeList = new ArrayList<>();
for (Recipe recipe : getRecipes(playerMP.world, RecipeType.CRAFTING)) {
if (isRecipeValid(recipe)) {
recipeList.add(recipe);
}
@ -80,8 +52,8 @@ public class TRRecipeHandler {
playerMP.unlockRecipes(recipeList);
}
public static <T extends Recipe> List<Recipe> getRecipes(World world, RecipeType<T> type){
return world.getRecipeManager().getRecipes().stream().filter(iRecipe -> iRecipe.getType() == type).collect(Collectors.toList());
public static <T extends Recipe<?>> List<Recipe> getRecipes(World world, RecipeType<T> type){
return world.getRecipeManager().values().stream().filter(iRecipe -> iRecipe.getType() == type).collect(Collectors.toList());
}
/**
@ -89,10 +61,10 @@ public class TRRecipeHandler {
* Used to get the matching output of a recipe type that only has 1 input
*
*/
public static <T extends Recipe> ItemStack getMatchingRecipes(World world, RecipeType<T> type, ItemStack input){
public static <T extends Recipe<?>> ItemStack getMatchingRecipes(World world, RecipeType<T> type, ItemStack input){
return getRecipes(world, type).stream()
.filter(iRecipe -> iRecipe.getIngredients().size() == 1 && iRecipe.getIngredients().get(0).test(input))
.map(Recipe::getRecipeOutput)
.filter(recipe -> recipe.getPreviewInputs().size() == 1 && ((Ingredient)recipe.getPreviewInputs().get(0)).test(input))
.map(Recipe::getOutput)
.findFirst()
.orElse(ItemStack.EMPTY);
}
@ -104,19 +76,13 @@ public class TRRecipeHandler {
if (!recipe.getId().getNamespace().equals(TechReborn.MOD_ID)) {
return false;
}
if (!recipe.getOutput().getItem().getRegistryName().getNamespace().equals(TechReborn.MOD_ID)) {
return false;
}
// if (!recipe.getOutput().getItem().getRegistryName().getNamespace().equals(TechReborn.MOD_ID)) {
// return false;
// }
// if (hiddenEntrys.contains(recipe.getRecipeOutput().getItem())) {
// return false;
// }
//Hide uu recipes
for (Ingredient ingredient : recipe.getPreviewInputs()) {
if (ingredient.method_8093(TRContent.Parts.UU_MATTER.getStack())) {
return false;
}
}
return true;
return !recipe.getPreviewInputs().stream().anyMatch((Predicate<Ingredient>) ingredient -> ingredient.method_8093(TRContent.Parts.UU_MATTER.getStack()));
}
}

View file

@ -28,27 +28,27 @@ import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import techreborn.init.TRContent;
public class TRTickHandler {
public Item previouslyWearing;
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
PlayerEntity player = e.player;
Item chestslot = !player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()
? player.getEquippedStack(EquipmentSlot.CHEST).getItem() : null;
//TODO fixable with a newer version of fabric
if (previouslyWearing != chestslot && previouslyWearing == TRContent.CLOAKING_DEVICE && player.isInvisible()
&& !player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
player.setInvisible(false);
}
previouslyWearing = chestslot;
}
//
// @SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
// public void onPlayerTick(TickEvent.PlayerTickEvent e) {
// PlayerEntity player = e.player;
// Item chestslot = !player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()
// ? player.getEquippedStack(EquipmentSlot.CHEST).getItem() : null;
//
// if (previouslyWearing != chestslot && previouslyWearing == TRContent.CLOAKING_DEVICE && player.isInvisible()
// && !player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
// player.setInvisible(false);
// }
//
// previouslyWearing = chestslot;
// }
}

View file

@ -25,7 +25,6 @@
package techreborn.init;
import net.minecraft.util.Identifier;
import reborncore.fluid.Fluid;
import techreborn.blocks.fluid.BlockFluidTechReborn;
public enum ModFluids {

View file

@ -27,12 +27,6 @@ package techreborn.init;
import net.minecraft.util.Identifier;
import net.minecraft.world.loot.LootPool;
import net.minecraft.world.loot.LootTables;
import net.minecraft.world.loot.UniformLootTableRange;
import net.minecraft.world.loot.condition.LootCondition;
import net.minecraft.world.loot.entry.LootTableEntry;
import net.minecraft.world.storage.loot.*;
import techreborn.TechReborn;
import techreborn.config.ConfigTechReborn;
@ -64,32 +58,32 @@ public class ModLoot {
}
for (Identifier lootTable : lootTables) {
LootTables.registerLootTable(lootTable);
//LootTables.registerLootTable(lootTable);
}
}
@SubscribeEvent
public void lootLoad(LootTableLoadEvent event) {
if (!event.getName().getNamespace().equals("minecraft")) {
return;
}
for (Identifier lootTable : lootTables) {
if (event.getName().getNamespace().equals(lootTable.getPath())) {
event.getTable().addPool(getLootPool(lootTable));
TechReborn.LOGGER.debug("Loot pool injected into " + lootTable.getPath());
}
}
}
/**
* Generates loot pool to be injected into vanilla loot pools
*
* @param lootTable ResourceLocation Loot table to inject
* @return LootPool Loot pool to inject
*/
private LootPool getLootPool(Identifier lootTable) {
LootEntry entry = new LootTableEntry(lootTable, 1, 0, new LootCondition[0], "lootEntry_" + lootTable.toString());
LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], new UniformLootTableRange(1), new UniformLootTableRange(0, 1), "lootPool_" + lootTable.toString());
return pool;
}
// @SubscribeEvent
// public void lootLoad(LootTableLoadEvent event) {
// if (!event.getName().getNamespace().equals("minecraft")) {
// return;
// }
// for (Identifier lootTable : lootTables) {
// if (event.getName().getNamespace().equals(lootTable.getPath())) {
// event.getTable().addPool(getLootPool(lootTable));
// TechReborn.LOGGER.debug("Loot pool injected into " + lootTable.getPath());
// }
// }
// }
//
// /**
// * Generates loot pool to be injected into vanilla loot pools
// *
// * @param lootTable ResourceLocation Loot table to inject
// * @return LootPool Loot pool to inject
// */
// private LootPool getLootPool(Identifier lootTable) {
// LootEntry entry = new LootTableEntry(lootTable, 1, 0, new LootCondition[0], "lootEntry_" + lootTable.toString());
// LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], new UniformLootTableRange(1), new UniformLootTableRange(0, 1), "lootPool_" + lootTable.toString());
// return pool;
// }
}

View file

@ -26,11 +26,13 @@ package techreborn.init;
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 reborncore.fluid.Fluid;
import reborncore.fluid.FluidStack;
import reborncore.fluid.FluidUtil;
import techreborn.TechReborn;
import techreborn.api.recipe.recipes.BlastFurnaceRecipe;
import techreborn.api.recipe.recipes.IndustrialGrinderRecipe;
@ -368,7 +370,7 @@ public class ModRecipes {
public static ItemStack getBucketWithFluid(Fluid fluid) {
return FluidUtil.getFilledBucket(new FluidStack(fluid, Fluid.BUCKET_VOLUME));
return FluidUtil.getFilledBucket(new FluidStack(fluid, 1000));
}
}

View file

@ -28,7 +28,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import reborncore.common.recipes.ICrafterSoundHanlder;
import reborncore.common.recipes.RecipeCrafter;
@ -62,10 +62,9 @@ public class ModSounds {
}
private static SoundEvent getSound(String str) {
Identifier resourceLocation = new Identifier("techreborn", str);
SoundEvent soundEvent = new SoundEvent(resourceLocation);
soundEvent.setRegistryName(resourceLocation);
return GameData.register_impl(soundEvent);
Identifier identifier = new Identifier("techreborn", str);
SoundEvent soundEvent = new SoundEvent(identifier);
return Registry.register(Registry.SOUND_EVENT, identifier, soundEvent);
}
public static class SoundHandler implements ICrafterSoundHanlder {

View file

@ -1,40 +0,0 @@
/*
* 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.init;
import net.minecraft.block.Block;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier;
public class ModTags {
public static Tag<Block> FENCE_IRON = get("fence_iron");
private static <T> Tag<T> get(String name) {
return (Tag<T>) new BlockTags.CachingTag(new Identifier("techreborn", name));
}
}

View file

@ -24,7 +24,6 @@
package techreborn.init;
import java.util.function.Supplier;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.recipe.Ingredient;
@ -33,6 +32,8 @@ import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Lazy;
import techreborn.TechReborn;
import java.util.function.Supplier;
public enum TRArmorMaterial implements ArmorMaterial {

View file

@ -24,6 +24,10 @@
package techreborn.init;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import reborncore.common.tile.TileMachineBase;
import techreborn.TechReborn;
import techreborn.tiles.*;
@ -41,12 +45,7 @@ import techreborn.tiles.machine.iron.TileIronAlloyFurnace;
import techreborn.tiles.machine.iron.TileIronFurnace;
import techreborn.tiles.machine.multiblock.*;
import techreborn.tiles.machine.tier1.*;
import techreborn.tiles.machine.tier3.TileChunkLoader;
import techreborn.tiles.machine.tier3.TileCreativeQuantumChest;
import techreborn.tiles.machine.tier3.TileCreativeQuantumTank;
import techreborn.tiles.machine.tier3.TileMatterFabricator;
import techreborn.tiles.machine.tier3.TileQuantumChest;
import techreborn.tiles.machine.tier3.TileQuantumTank;
import techreborn.tiles.machine.tier3.*;
import techreborn.tiles.storage.TileAdjustableSU;
import techreborn.tiles.storage.TileHighVoltageSU;
import techreborn.tiles.storage.TileLowVoltageSU;
@ -60,9 +59,6 @@ import techreborn.tiles.transformers.TileMVTransformer;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.Identifier;
public class TRTileEntities {
@ -96,7 +92,7 @@ public class TRTileEntities {
public static final BlockEntityType<TileAdjustableSU> ADJUSTABLE_SU = register(TileAdjustableSU.class, "adjustable_su");
public static final BlockEntityType<TileLapotronicSU> LAPOTRONIC_SU = register(TileLapotronicSU.class, "lapotronic_su");
public static final BlockEntityType<TileLSUStorage> LSU_STORAGE = register(TileLSUStorage.class, "lsu_storage");
public static final BlockEntityType<TileEnvTypeillationTower> EnvTypeILLATION_TOWER = register(TileEnvTypeillationTower.class, "EnvTypeillation_tower");
public static final BlockEntityType<TileDistillationTower> EnvTypeILLATION_TOWER = register(TileDistillationTower.class, "distillation_tower");
public static final BlockEntityType<TileVacuumFreezer> VACUUM_FREEZER = register(TileVacuumFreezer.class, "vacuum_freezer");
public static final BlockEntityType<TileFusionControlComputer> FUSION_CONTROL_COMPUTER = register(TileFusionControlComputer.class, "fusion_control_computer");
public static final BlockEntityType<TileLightningRod> LIGHTNING_ROD = register(TileLightningRod.class, "lightning_rod");
@ -142,7 +138,7 @@ public class TRTileEntities {
public static <T extends BlockEntity> BlockEntityType<T> register(String id, BlockEntityType.Builder<T> builder) {
BlockEntityType<T> tileEntityType = builder.build(null);
tileEntityType.setRegistryName(new Identifier(id));
Registry.register(Registry.BLOCK_ENTITY, new Identifier("techrebonr", id), tileEntityType);
TRTileEntities.TYPES.add(tileEntityType);
return tileEntityType;
}

View file

@ -24,11 +24,12 @@
package techreborn.init;
import java.util.function.Supplier;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.util.Lazy;
import java.util.function.Supplier;
//TODO: Use tags
public enum TRToolTier implements ToolMaterial {
BRONZE(2, 375, 6.0f, 2.25f, 8, () -> {

View file

@ -24,8 +24,6 @@
package techreborn.init.recipes;
import java.security.InvalidParameterException;
import net.minecraft.item.ItemStack;

View file

@ -34,7 +34,7 @@ import java.security.InvalidParameterException;
* @author drcrazy
*
*/
public class EnvTypeillationTowerRecipes extends RecipeMethods {
public class DistillationTowerRecipes extends RecipeMethods {
public static void init() {
register(ItemCells.getCellByName("oil", 16), 1400, 13, getMaterial("diesel", 16, Type.CELL), getMaterial("sulfuricAcid", 16, Type.CELL), getMaterial("glyceryl", Type.CELL));

View file

@ -103,7 +103,7 @@ public class ScrapboxRecipes extends RecipeMethods {
register(getStack(Items.SPIDER_EYE));
register(getStack(Items.SLIME_BALL));
register(getStack(Items.ROTTEN_FLESH));
register(getStack(Items.SIGN));
register(getStack(Items.OAK_SIGN));
register(getStack(Items.WRITABLE_BOOK));
register(getStack(Items.COOKED_BEEF));
register(getStack(Items.NAME_TAG));

View file

@ -36,7 +36,6 @@ import org.apache.commons.lang3.Validate;
import reborncore.fluid.Fluid;
import reborncore.fluid.FluidStack;
import techreborn.TechReborn;
import techreborn.events.TRRecipeHandler;
import techreborn.init.TRContent;
import techreborn.utils.FluidUtils;
@ -49,7 +48,6 @@ public class DynamicCell extends Item {
public DynamicCell() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
TRRecipeHandler.hideEntry(this);
}
@Override
@ -104,7 +102,7 @@ public class DynamicCell extends Item {
public static ItemStack getCellWithFluid(Fluid fluid, int stackSize) {
Validate.notNull(fluid);
ItemStack stack = new ItemStack(TRContent.CELL);
getFluidHandler(stack).fill(new FluidStack(fluid, CAPACITY), true);
//getFluidHandler(stack).fill(new FluidStack(fluid, CAPACITY), true);
stack.setAmount(stackSize);
return stack;
}

View file

@ -25,8 +25,8 @@
package techreborn.items;
import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.Validate;
import reborncore.fluid.Fluid;
import techreborn.utils.FluidUtils;
public class ItemCells {

View file

@ -24,6 +24,8 @@
package techreborn.items;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.ChatFormat;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.client.resource.language.I18n;
@ -43,8 +45,7 @@ import net.minecraft.util.TypedActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.world.dimension.DimensionType;
import reborncore.client.hud.StackInfoElement;
import reborncore.common.util.ChatUtils;
import techreborn.TechReborn;
@ -92,8 +93,8 @@ public class ItemFrequencyTransmitter extends Item {
ChatFormat.GRAY + " Z: " +
ChatFormat.GOLD + pos.getZ() +
ChatFormat.GRAY + " " + I18n.translate("techreborn.message.in") + " " +
ChatFormat.GOLD + world.getDimension().getType().getRegistryName()
+ " (" + world.getDimension().getType().getRegistryName() + ")"));
ChatFormat.GOLD + getDimName(world.getDimension().getType())
+ " (" + getDimName(world.getDimension().getType()) + ")"));
}
return ActionResult.SUCCESS;
}
@ -126,13 +127,17 @@ public class ItemFrequencyTransmitter extends Item {
tooltip.add(new TextComponent(ChatFormat.GRAY + "X: " + ChatFormat.GOLD + x));
tooltip.add(new TextComponent(ChatFormat.GRAY + "Y: " + ChatFormat.GOLD + y));
tooltip.add(new TextComponent(ChatFormat.GRAY + "Z: " + ChatFormat.GOLD + z));
tooltip.add(new TextComponent(ChatFormat.DARK_GRAY + Registry.DIMENSION.get(dim).getRegistryName().toString()));
tooltip.add(new TextComponent(ChatFormat.DARK_GRAY + getDimName(Registry.DIMENSION.get(dim)).toString()));
} else {
tooltip.add(new TextComponent(ChatFormat.GRAY + I18n.translate("techreborn.message.noCoordsSet")));
}
}
private static Identifier getDimName(DimensionType type){
return Registry.DIMENSION.getId(type);
}
public static class StackInfoFreqTransmitter extends StackInfoElement {
public StackInfoFreqTransmitter() {
super(TRContent.FREQUENCY_TRANSMITTER);
@ -149,7 +154,7 @@ public class ItemFrequencyTransmitter extends Item {
int coordY = stack.getTag().getInt("y");
int coordZ = stack.getTag().getInt("z");
int coordDim = stack.getTag().getInt("dim");
text = grey + "X: " + gold + coordX + grey + " Y: " + gold + coordY + grey + " Z: " + gold + coordZ + grey + " Dim: " + gold + Registry.DIMENSION.get(coordDim).getRegistryName().toString() + " (" + coordDim + ")";
text = grey + "X: " + gold + coordX + grey + " Y: " + gold + coordY + grey + " Z: " + gold + coordZ + grey + " Dim: " + gold + getDimName(Registry.DIMENSION.get(coordDim)).toString() + " (" + coordDim + ")";
} else {
text = grey + I18n.translate("techreborn.message.noCoordsSet");
}

View file

@ -31,7 +31,7 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import reborncore.common.crafting.Recipe;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.util.WorldUtils;
import techreborn.TechReborn;
import techreborn.init.ModRecipes;
@ -48,7 +48,7 @@ public class ItemScrapBox extends Item {
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
ItemStack stack = player.getMainHandStack();
if (!world.isClient) {
List<Recipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(world);
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(world);
int random = world.random.nextInt(scrapboxRecipeList.size());
ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0);
WorldUtils.dropItem(out, world, player.getBlockPos());

View file

@ -24,23 +24,19 @@
package techreborn.items.armor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.DefaultedList;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.PoweredItemContainerProvider;
import reborncore.common.powerSystem.ItemPowerManager;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.registration.RebornRegister;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
@ -48,8 +44,6 @@ import techreborn.config.ConfigTechReborn;
import techreborn.init.TRArmorMaterial;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
@RebornRegister(TechReborn.MOD_ID)
public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo {
@ -63,18 +57,11 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
super(TRArmorMaterial.CLOAKING, EquipmentSlot.CHEST);
}
// Item
@Override
@Environment(EnvType.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return "techreborn:" + "textures/models/armor/cloaking.png";
}
@Override
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entityIn;
IEnergyStorage capEnergy = new ItemPowerManager(stack);
ItemPowerManager capEnergy = new ItemPowerManager(stack);
if (capEnergy != null && capEnergy.getEnergyStored() >= usage) {
capEnergy.extractEnergy(usage, false);
player.setInvisible(true);

View file

@ -24,28 +24,23 @@
package techreborn.items.armor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.DefaultedList;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.PoweredItemContainerProvider;
import reborncore.common.powerSystem.ItemPowerManager;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.config.ConfigTechReborn;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
// 400M FE maxCharge and 100k FE\t charge rate. Fully charged in 3 mins.
@ -93,13 +88,6 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo,
return PowerSystem.getDisplayPower().colour;
}
@Override
@Environment(EnvType.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return "techreborn:" + "textures/models/armor/lapotronpack.png";
}
// IEnergyItemInfo
@Override
public int getCapacity() {

View file

@ -24,28 +24,24 @@
package techreborn.items.armor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.DefaultedList;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.ItemPowerManager;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.config.ConfigTechReborn;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
// 8M FE maxCharge and 2k FE\t charge rate. Fully charged in 3 mins.
@ -65,7 +61,8 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
for (int i = 0; i < player.inventory.getInvSize(); i++) {
if (!player.inventory.getInvStack(i).isEmpty()) {
ExternalPowerSystems.chargeItem(capEnergy, player.inventory.getInvStack(i));
//TODO fix me
//ExternalPowerSystems.chargeItem(capEnergy, player.inventory.getInvStack(i));
}
}
}
@ -93,12 +90,6 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
return PowerSystem.getDisplayPower().colour;
}
@Override
@Environment(EnvType.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return "techreborn:" + "textures/models/armor/lithiumbatpack.png";
}
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {

View file

@ -54,9 +54,10 @@ public class ItemTRArmour extends ArmorItem implements ItemDurabilityExtensions
//setTranslationKey(material.name().toLowerCase() + "Chestplate");
if (slot == EquipmentSlot.LEGS)
//setTranslationKey(material.name().toLowerCase() + "Leggings");
if (slot == EquipmentSlot.FEET)
if (slot == EquipmentSlot.FEET) {
}
//setTranslationKey(material.name().toLowerCase() + "Boots");
TRRecipeHandler.hideEntry(this);
}
@Override

View file

@ -24,26 +24,24 @@
package techreborn.items.battery;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPropertyGetter;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.PoweredItemContainerProvider;
import reborncore.common.powerSystem.ItemPowerManager;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import javax.annotation.Nullable;
public class ItemBattery extends Item implements IEnergyItemInfo {
public class ItemBattery extends Item implements IEnergyItemInfo, ItemDurabilityExtensions {
int maxEnergy = 0;
int maxTransfer = 0;

View file

@ -24,11 +24,11 @@
package techreborn.items.battery;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.common.powerSystem.ItemPowerManager;
import techreborn.config.ConfigTechReborn;
import techreborn.init.TRContent;

View file

@ -24,11 +24,11 @@
package techreborn.items.battery;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.common.powerSystem.ItemPowerManager;
import techreborn.config.ConfigTechReborn;
import techreborn.init.TRContent;

View file

@ -24,11 +24,11 @@
package techreborn.items.battery;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.common.powerSystem.ItemPowerManager;
import techreborn.config.ConfigTechReborn;
import techreborn.init.TRContent;

View file

@ -24,11 +24,11 @@
package techreborn.items.battery;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.common.powerSystem.ItemPowerManager;
import techreborn.init.TRContent;

View file

@ -24,11 +24,11 @@
package techreborn.items.battery;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.common.powerSystem.ItemPowerManager;
import techreborn.init.TRContent;

View file

@ -24,25 +24,21 @@
package techreborn.items.tool;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.*;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
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.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
@ -62,7 +58,6 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
public ItemChainsaw(ToolMaterials material, int energyCapacity, float unpoweredSpeed) {
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
this.maxCharge = energyCapacity;
this.blockBreakingSpeed = unpoweredSpeed;
this.addProperty(new Identifier("techreborn", "animated"), new ItemPropertyGetter() {
@Override
@ -81,7 +76,7 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
@Override
public float getBlockBreakingSpeed(ItemStack stack, BlockState state) {
if (new ItemPowerManager(stack).getEnergyStored() >= cost
&& (state.getBlock().isToolEffective(state, ToolType.AXE) || state.getMaterial() == Material.WOOD)) {
&& (state.getMaterial() == Material.WOOD)) {
return this.poweredSpeed;
} else {
return super.getBlockBreakingSpeed(stack, state);
@ -122,12 +117,7 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
}
@Override
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
return !(newStack.isEqualIgnoreTags(oldStack));
}
@Override
public boolean isRepairable() {
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
return false;
}

View file

@ -24,7 +24,6 @@
package techreborn.items.tool;
import java.util.Map.Entry;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -35,12 +34,13 @@ import net.minecraft.network.chat.TextComponent;
import net.minecraft.state.property.Property;
import net.minecraft.util.ActionResult;
import net.minecraft.util.SystemUtil;
import net.minecraft.util.registry.Registry;
import reborncore.api.power.IEnergyInterfaceTile;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.TechReborn;
import java.util.Map.Entry;
/**
* Created by Mark on 20/03/2016.
*/

View file

@ -28,25 +28,17 @@ import net.minecraft.block.BlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.item.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
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.powerSystem.PowerSystem;
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, ItemDurabilityExtensions {
@ -58,7 +50,6 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
public ItemDrill(ToolMaterial material, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) {
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
this.blockBreakingSpeed = efficiencyOnProperMaterial;
this.maxCharge = energyCapacity;
this.unpoweredSpeed = unpoweredSpeed;
}
@ -97,7 +88,7 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
//Item
@Override
public boolean isRepairable() {
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
return false;
}
@ -116,11 +107,6 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
return PowerSystem.getDisplayPower().colour;
}
@Override
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
return !(newStack.isEqualIgnoreTags(oldStack));
}
// IEnergyItemInfo
@Override
public int getCapacity() {

View file

@ -34,21 +34,17 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterials;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
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.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.utils.TagUtils;
import javax.annotation.Nullable;
import java.util.Random;
public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
@ -59,7 +55,6 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
public ItemJackhammer(ToolMaterials material, int energyCapacity) {
super(material, (int) material.getAttackDamage(), 1f, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
blockBreakingSpeed = 20F;
this.maxCharge = energyCapacity;
}
@ -93,14 +88,9 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
}
// Item
@Override
public boolean canHarvestBlock( final ItemStack stack, final BlockState state) {
return TagUtils.isOre(state, "stone")
|| state.getMaterial() == Material.STONE && new ItemPowerManager(stack).getEnergyStored() >= cost;
}
@Override
public boolean isRepairable() {
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
return false;
}
@ -119,11 +109,6 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
return PowerSystem.getDisplayPower().colour;
}
@Override
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
return !(newStack.isEqualIgnoreTags(oldStack));
}
// IEnergyItemInfo
@Override
public int getCapacity() {

Some files were not shown because too many files have changed in this diff Show more