Merge remote-tracking branch 'origin/1.15' into 1.15

This commit is contained in:
modmuss50 2019-12-22 18:01:27 +00:00
commit 4cc07abe90
40 changed files with 539 additions and 240 deletions

View file

@ -33,6 +33,9 @@ import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.Direction;
import reborncore.api.IToolDrop;
import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import reborncore.common.powerSystem.PowerSystem;
@ -45,25 +48,26 @@ import techreborn.init.TRContent.SolarPanels;
import java.util.List;
public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop {
public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, IContainerProvider {
// State ZEROGEN: No exposure to sun
// State NIGHTGEN: Has direct exposure to sun
// State DAYGEN: Has exposure to sun and weather is sunny and not raining/thundering
public static final int ZEROGEN = 0;
public static final int NIGHTGEN = 1;
public static final int DAYGEN = 2;
private int state = ZEROGEN;
private int prevState = ZEROGEN;
boolean canSeeSky = false;
boolean lastState = false;
private SolarPanels panel;
public SolarPanelBlockEntity() {
super(TRBlockEntities.SOLAR_PANEL);
}
public SolarPanelBlockEntity(SolarPanels panel) {
super(TRBlockEntities.SOLAR_PANEL);
this.panel = panel;
}
public boolean isSunOut() {
return canSeeSky && !world.isRaining() && !world.isThundering() && world.isDay();
}
private void updatePanel() {
if (world == null) {
return;
@ -75,35 +79,81 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
}
}
// PowerAcceptorBlockEntity
// Setters and getters for the GUI to sync
private void setSunState(int state) {
this.state = state;
}
public int getSunState() {
return state;
}
SolarPanels getPanel() {
if (panel == null) {
updatePanel();
}
return panel;
}
private void updateState() {
if (world.isSkyVisible(pos.up())) {
this.setSunState(NIGHTGEN);
if (!world.isRaining() && !world.isThundering() && world.isDay()) {
this.setSunState(DAYGEN);
}
} else {
this.setSunState(ZEROGEN);
}
if (prevState != this.getSunState()) {
boolean isGenerating = getSunState() == DAYGEN;
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, isGenerating));
prevState = this.getSunState();
}
}
public int getGenerationRate() {
int rate = 0;
switch (getSunState()) {
case DAYGEN:
rate = getPanel().generationRateD;
break;
case NIGHTGEN:
rate = getPanel().generationRateN;
}
return rate;
}
// Overrides
@Override
public void tick() {
super.tick();
if (world.isClient) {
return;
}
if (getPanel() == TRContent.SolarPanels.CREATIVE) {
checkOverfill = false;
setEnergy(Integer.MAX_VALUE);
return;
}
// State checking and updating
if (world.getTime() % 20 == 0) {
canSeeSky = world.isSkyVisible(pos.up());
if (lastState != isSunOut()) {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, isSunOut()));
lastState = isSunOut();
}
}
int powerToAdd;
if (isSunOut()) {
powerToAdd = getPanel().generationRateD;
} else if (canSeeSky) {
powerToAdd = getPanel().generationRateN;
} else {
powerToAdd = 0;
updateState();
}
addEnergy(powerToAdd);
// Power generation calculations
addEnergy(getGenerationRate());
}
@Override
@ -123,7 +173,8 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
@Override
public double getBaseMaxOutput() {
return getPanel().generationRateD;
// Solar panel output will only be limited by the cables the users use
return EnergyTier.EXTREME.getMaxOutput();
}
@Override
@ -131,6 +182,16 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
return 0;
}
@Override
public boolean canBeUpgraded() {
return false;
}
@Override
public boolean hasSlotConfig() {
return false;
}
@Override
public EnergyTier getTier() {
return getPanel().powerTier;
@ -141,13 +202,6 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
// Nope
}
public SolarPanels getPanel() {
if(panel == null){
updatePanel();
}
return panel;
}
@Override
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
if (panel == SolarPanels.CREATIVE) {
@ -188,4 +242,12 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
public ItemStack getToolDrop(final PlayerEntity playerIn) {
return new ItemStack(getBlockType());
}
@Override
public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
return new ContainerBuilder("solar_panel").player(player.inventory).inventory().hotbar().addInventory()
.blockEntity(this).syncEnergyValue()
.sync(this::getSunState, this::setSunState)
.addInventory().create(this, syncID);
}
}

View file

@ -32,6 +32,10 @@ import net.minecraft.world.World;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
import techreborn.blocks.GenericMachineBlock;
import techreborn.client.EGui;
import techreborn.client.gui.GuiSolar;
import techreborn.init.TRContent.SolarPanels;
import techreborn.blockentity.generator.SolarPanelBlockEntity;
@ -54,7 +58,10 @@ public class BlockSolarPanel extends BlockMachineBase {
@Override
public IMachineGuiHandler getGui() {
return null;
if(this.panelType == SolarPanels.CREATIVE){
return null;
}
return EGui.SOLAR_PANEL;
}
@Override

View file

@ -52,7 +52,7 @@ import team.reborn.energy.Energy;
import techreborn.events.TRRecipeHandler;
import techreborn.init.ModSounds;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemTreeTap;
import techreborn.items.tool.TreeTapItem;
import java.util.Random;
/**
@ -135,7 +135,7 @@ public class BlockRubberLog extends LogBlock {
return ActionResult.SUCCESS;
}
if ((Energy.valid(stack) && Energy.of(stack).getEnergy() > 20) || stack.getItem() instanceof ItemTreeTap) {
if ((Energy.valid(stack) && Energy.of(stack).getEnergy() > 20) || stack.getItem() instanceof TreeTapItem) {
if (state.get(HAS_SAP) && state.get(SAP_SIDE) == hitResult.getSide()) {
worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, Direction.fromHorizontal(0)));
worldIn.playSound(playerIn, pos, ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS, 0.6F, 1F);

View file

@ -74,6 +74,7 @@ public enum EGui implements IMachineGuiHandler {
ROLLING_MACHINE,
SAWMILL,
SCRAPBOXINATOR,
SOLAR_PANEL,
SEMIFLUID_GENERATOR,
THERMAL_GENERATOR,
VACUUM_FREEZER,

View file

@ -41,6 +41,7 @@ import techreborn.blockentity.data.DataDrivenBEProvider;
import techreborn.blockentity.data.DataDrivenGui;
import techreborn.blockentity.fusionReactor.FusionControlComputerBlockEntity;
import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity;
import techreborn.blockentity.generator.SolarPanelBlockEntity;
import techreborn.blockentity.generator.advanced.DieselGeneratorBlockEntity;
import techreborn.blockentity.generator.advanced.GasTurbineBlockEntity;
import techreborn.blockentity.generator.advanced.SemiFluidGeneratorBlockEntity;
@ -149,6 +150,8 @@ public class GuiHandler {
return new GuiIndustrialSawmill(syncID, player, (IndustrialSawmillBlockEntity) blockEntity);
case SCRAPBOXINATOR:
return new GuiScrapboxinator(syncID, player, (ScrapboxinatorBlockEntity) blockEntity);
case SOLAR_PANEL:
return new GuiSolar(syncID, player, (SolarPanelBlockEntity) blockEntity);
case SEMIFLUID_GENERATOR:
return new GuiSemifluidGenerator(syncID, player, (SemiFluidGeneratorBlockEntity) blockEntity);
case THERMAL_GENERATOR:

View file

@ -0,0 +1,70 @@
/*
* 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.gui;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.util.StringUtils;
import techreborn.blockentity.generator.SolarPanelBlockEntity;
public class GuiSolar extends GuiBase<BuiltContainer> {
SolarPanelBlockEntity blockEntity;
public GuiSolar(int syncID, PlayerEntity player, SolarPanelBlockEntity panel) {
super(player, panel, panel.createContainer(syncID, player));
this.blockEntity = panel;
}
@Override
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(lastFrameDuration, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
}
@Override
protected void drawForeground(int mouseX, int mouseY) {
super.drawForeground(mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 156, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
switch (blockEntity.getSunState()) {
case SolarPanelBlockEntity.DAYGEN:
builder.drawString(this, StringUtils.t("techreborn.message.daygen"), 10, 20, 15129632);
break;
case SolarPanelBlockEntity.NIGHTGEN:
builder.drawString(this, StringUtils.t("techreborn.message.nightgen"), 10, 20, 7566195);
break;
case SolarPanelBlockEntity.ZEROGEN:
builder.drawString(this, StringUtils.t("techreborn.message.zerogen"), 10, 20, 12066591);
break;
}
builder.drawString(this, "Generating: " + blockEntity.getGenerationRate() + " E/t", 10, 30, 0);
}
}

View file

@ -38,8 +38,12 @@ import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.RecipeManager;
import techreborn.TechReborn;
import techreborn.api.generator.EFluidGenerator;
import techreborn.api.generator.GeneratorRecipeHelper;
import techreborn.api.recipe.recipes.FluidReplicatorRecipe;
import techreborn.api.recipe.recipes.RollingMachineRecipe;
import techreborn.compat.rei.fluidgenerator.FluidGeneratorRecipeCategory;
import techreborn.compat.rei.fluidgenerator.FluidGeneratorRecipeDisplay;
import techreborn.compat.rei.fluidreplicator.FluidReplicatorRecipeCategory;
import techreborn.compat.rei.fluidreplicator.FluidReplicatorRecipeDisplay;
import techreborn.compat.rei.rollingmachine.RollingMachineCategory;
@ -81,7 +85,6 @@ public class ReiPlugin implements REIPluginV0 {
iconMap.put(ModRecipes.SOLID_CANNING_MACHINE, Machine.SOLID_CANNING_MACHINE);
iconMap.put(ModRecipes.VACUUM_FREEZER, Machine.VACUUM_FREEZER);
iconMap.put(ModRecipes.WIRE_MILL, Machine.WIRE_MILL);
}
@Override
@ -116,11 +119,23 @@ public class ReiPlugin implements REIPluginV0 {
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.SOLID_CANNING_MACHINE));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.VACUUM_FREEZER, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.WIRE_MILL, 1));
recipeHelper.registerCategory(new FluidGeneratorRecipeCategory(Machine.THERMAL_GENERATOR));
recipeHelper.registerCategory(new FluidGeneratorRecipeCategory(Machine.GAS_TURBINE));
recipeHelper.registerCategory(new FluidGeneratorRecipeCategory(Machine.DIESEL_GENERATOR));
recipeHelper.registerCategory(new FluidGeneratorRecipeCategory(Machine.SEMI_FLUID_GENERATOR));
recipeHelper.registerCategory(new FluidGeneratorRecipeCategory(Machine.PLASMA_GENERATOR));
}
@Override
public void registerRecipeDisplays(RecipeHelper recipeHelper) {
RecipeManager.getRecipeTypes("techreborn").forEach(rebornRecipeType -> registerMachineRecipe(recipeHelper, rebornRecipeType));
registerFluidGeneratorDisplays(recipeHelper, EFluidGenerator.THERMAL, Machine.THERMAL_GENERATOR);
registerFluidGeneratorDisplays(recipeHelper, EFluidGenerator.GAS, Machine.GAS_TURBINE);
registerFluidGeneratorDisplays(recipeHelper, EFluidGenerator.DIESEL, Machine.DIESEL_GENERATOR);
registerFluidGeneratorDisplays(recipeHelper, EFluidGenerator.SEMIFLUID, Machine.SEMI_FLUID_GENERATOR);
registerFluidGeneratorDisplays(recipeHelper, EFluidGenerator.PLASMA, Machine.PLASMA_GENERATOR);
}
@Override
@ -143,6 +158,11 @@ public class ReiPlugin implements REIPluginV0 {
recipeHelper.registerWorkingStations(ModRecipes.SOLID_CANNING_MACHINE.getName(), EntryStack.create(Machine.SOLID_CANNING_MACHINE));
recipeHelper.registerWorkingStations(ModRecipes.VACUUM_FREEZER.getName(), EntryStack.create(Machine.VACUUM_FREEZER));
recipeHelper.registerWorkingStations(ModRecipes.WIRE_MILL.getName(), EntryStack.create(Machine.WIRE_MILL));
recipeHelper.registerWorkingStations(new Identifier(TechReborn.MOD_ID, Machine.THERMAL_GENERATOR.name), EntryStack.create(Machine.THERMAL_GENERATOR));
recipeHelper.registerWorkingStations(new Identifier(TechReborn.MOD_ID, Machine.GAS_TURBINE.name), EntryStack.create(Machine.GAS_TURBINE));
recipeHelper.registerWorkingStations(new Identifier(TechReborn.MOD_ID, Machine.DIESEL_GENERATOR.name), EntryStack.create(Machine.DIESEL_GENERATOR));
recipeHelper.registerWorkingStations(new Identifier(TechReborn.MOD_ID, Machine.SEMI_FLUID_GENERATOR.name), EntryStack.create(Machine.SEMI_FLUID_GENERATOR));
recipeHelper.registerWorkingStations(new Identifier(TechReborn.MOD_ID, Machine.PLASMA_GENERATOR.name), EntryStack.create(Machine.PLASMA_GENERATOR));
}
@Override
@ -168,6 +188,13 @@ public class ReiPlugin implements REIPluginV0 {
stack.addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE);
}
private void registerFluidGeneratorDisplays(RecipeHelper recipeHelper, EFluidGenerator generator, Machine machine) {
Identifier identifier = new Identifier(TechReborn.MOD_ID, machine.name);
GeneratorRecipeHelper.getFluidRecipesForGenerator(generator).getRecipes().forEach(recipe -> {
recipeHelper.registerDisplay(identifier, new FluidGeneratorRecipeDisplay(recipe, identifier));
});
}
private <R extends RebornRecipe> void registerMachineRecipe(RecipeHelper recipeHelper, RebornRecipeType<R> recipeType) {
Function<R, RecipeDisplay> recipeDisplay = r -> new MachineRecipeDisplay<>((RebornRecipe) r);

View file

@ -0,0 +1,74 @@
package techreborn.compat.rei.fluidgenerator;
import me.shedaniel.math.api.Point;
import me.shedaniel.math.api.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeCategory;
import me.shedaniel.rei.gui.widget.*;
import me.shedaniel.rei.impl.ScreenHelper;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import reborncore.common.util.StringUtils;
import techreborn.TechReborn;
import techreborn.init.TRContent;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Supplier;
public class FluidGeneratorRecipeCategory implements RecipeCategory<FluidGeneratorRecipeDisplay> {
private TRContent.Machine generator;
private Identifier identifier;
public FluidGeneratorRecipeCategory(TRContent.Machine generator) {
this.generator = generator;
this.identifier = new Identifier(TechReborn.MOD_ID, generator.name);
}
@Override
public Identifier getIdentifier() {
return identifier;
}
@Override
public String getCategoryName() {
return StringUtils.t(identifier.toString());
}
@Override
public EntryStack getLogo() {
return EntryStack.create(generator);
}
@Override
public List<Widget> setupDisplay(Supplier<FluidGeneratorRecipeDisplay> recipeDisplaySupplier, Rectangle bounds) {
FluidGeneratorRecipeDisplay machineRecipe = recipeDisplaySupplier.get();
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 13);
List<Widget> widgets = new LinkedList<>();
widgets.add(new RecipeBaseWidget(bounds));
widgets.add(new RecipeArrowWidget(startPoint.x + 24, startPoint.y + 1, true));
for (List<EntryStack> inputs : machineRecipe.getInputEntries()) {
widgets.add(EntryWidget.create(startPoint.x + 1, startPoint.y + 1).entries(inputs));
}
Text energyPerTick = new TranslatableText("techreborn.jei.recipe.generator.total", machineRecipe.getTotalEnergy());
LabelWidget costLabel;
widgets.add(costLabel = new LabelWidget(bounds.getCenterX(), startPoint.y + 20, energyPerTick.asFormattedString()));
costLabel.setHasShadows(false);
costLabel.setDefaultColor(ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : 0xFF404040);
return widgets;
}
@Override
public int getDisplayHeight() {
return 37;
}
}

View file

@ -0,0 +1,44 @@
package techreborn.compat.rei.fluidgenerator;
import com.google.common.collect.Lists;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeDisplay;
import net.minecraft.util.Identifier;
import techreborn.api.generator.FluidGeneratorRecipe;
import java.util.Collections;
import java.util.List;
public class FluidGeneratorRecipeDisplay implements RecipeDisplay {
private List<List<EntryStack>> inputs;
private Identifier category;
private int totalEnergy;
public FluidGeneratorRecipeDisplay(FluidGeneratorRecipe recipe, Identifier category) {
this.category = category;
this.inputs = Lists.newArrayList();
this.totalEnergy = recipe.getEnergyPerBucket();
inputs.add(Collections.singletonList(EntryStack.create(recipe.getFluid(), 1000)));
}
@Override
public List<List<EntryStack>> getInputEntries() {
return inputs;
}
@Override
public List<EntryStack> getOutputEntries() {
return Lists.newArrayList();
}
@Override
public Identifier getRecipeCategory() {
return category;
}
public int getTotalEnergy() {
return totalEnergy;
}
}

View file

@ -30,6 +30,9 @@ import reborncore.common.config.Config;
public class TechRebornConfig {
// Generators
@Config(config = "generators", category = "solarPanelGeneral", key = "internalCapacity", comment = "Multiplier for internal capacity of solar panels (multiplier * day generation rate)")
public static int solarInternalCapacityMultiplier = 2000;
@Config(config = "generators", category = "solarPanelBasic", key = "basicDayRate", comment = "Generation rate during day for Basic Solar Panel (Value in FE)")
public static int basicGenerationRateD = 1;
@ -55,10 +58,10 @@ public class TechRebornConfig {
public static int ultimateGenerationRateN = 16;
@Config(config = "generators", category = "solarPanelQuantum", key = "quantumDayRate", comment = "Generation rate during day for Quantum Solar Panel (Value in FE)")
public static int quantumGenerationRateD = 1024;
public static int quantumGenerationRateD = 2048;
@Config(config = "generators", category = "solarPanelQuantum", key = "quantumNightRate", comment = "Generation rate during night for Quantum Solar Panel (Value in FE)")
public static int quantumGenerationRateN = 64;
public static int quantumGenerationRateN = 128;
@Config(config = "generators", category = "lightning_rod", key = "LightningRodMaxOutput", comment = "Lightning Rod Max Output (Value in EU)")
public static int lightningRodMaxOutput = 2048;

View file

@ -64,17 +64,17 @@ import techreborn.items.armor.ItemLithiumIonBatpack;
import techreborn.items.armor.ItemQuantumSuit;
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.DebugToolItem;
import techreborn.items.tool.TreeTapItem;
import techreborn.items.tool.WrenchItem;
import techreborn.items.tool.advanced.AdvancedChainsawItem;
import techreborn.items.tool.advanced.AdvancedDrillItem;
import techreborn.items.tool.advanced.AdvancedJackhammerItem;
import techreborn.items.tool.advanced.RockCutterItem;
import techreborn.items.tool.basic.BasicChainsawItem;
import techreborn.items.tool.basic.BasicDrillItem;
import techreborn.items.tool.basic.BasicJackhammerItem;
import techreborn.items.tool.basic.ElectricTreetapItem;
import techreborn.items.tool.industrial.*;
import techreborn.items.tool.vanilla.*;
import techreborn.utils.InitUtils;
@ -202,24 +202,24 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORBPACK = InitUtils.setup(new ItemLapotronicOrbpack(), "lapotronic_orbpack"));
// Tools
RebornRegistry.registerItem(TRContent.TREE_TAP = InitUtils.setup(new ItemTreeTap(), "treetap"));
RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new ItemWrench(), "wrench"));
RebornRegistry.registerItem(TRContent.TREE_TAP = InitUtils.setup(new TreeTapItem(), "treetap"));
RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new WrenchItem(), "wrench"));
RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new ItemBasicDrill(), "basic_drill"));
RebornRegistry.registerItem(TRContent.BASIC_CHAINSAW = InitUtils.setup(new ItemBasicChainsaw(), "basic_chainsaw"));
RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new ItemBasicJackhammer(), "basic_jackhammer"));
RebornRegistry.registerItem(TRContent.ELECTRIC_TREE_TAP = InitUtils.setup(new ItemElectricTreetap(), "electric_treetap"));
RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new BasicDrillItem(), "basic_drill"));
RebornRegistry.registerItem(TRContent.BASIC_CHAINSAW = InitUtils.setup(new BasicChainsawItem(), "basic_chainsaw"));
RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new BasicJackhammerItem(), "basic_jackhammer"));
RebornRegistry.registerItem(TRContent.ELECTRIC_TREE_TAP = InitUtils.setup(new ElectricTreetapItem(), "electric_treetap"));
RebornRegistry.registerItem(TRContent.ADVANCED_DRILL = InitUtils.setup(new ItemAdvancedDrill(), "advanced_drill"));
RebornRegistry.registerItem(TRContent.ADVANCED_CHAINSAW = InitUtils.setup(new ItemAdvancedChainsaw(), "advanced_chainsaw"));
RebornRegistry.registerItem(TRContent.ADVANCED_JACKHAMMER = InitUtils.setup(new ItemAdvancedJackhammer(), "advanced_jackhammer"));
RebornRegistry.registerItem(TRContent.ROCK_CUTTER = InitUtils.setup(new ItemRockCutter(), "rock_cutter"));
RebornRegistry.registerItem(TRContent.ADVANCED_DRILL = InitUtils.setup(new AdvancedDrillItem(), "advanced_drill"));
RebornRegistry.registerItem(TRContent.ADVANCED_CHAINSAW = InitUtils.setup(new AdvancedChainsawItem(), "advanced_chainsaw"));
RebornRegistry.registerItem(TRContent.ADVANCED_JACKHAMMER = InitUtils.setup(new AdvancedJackhammerItem(), "advanced_jackhammer"));
RebornRegistry.registerItem(TRContent.ROCK_CUTTER = InitUtils.setup(new RockCutterItem(), "rock_cutter"));
RebornRegistry.registerItem(TRContent.INDUSTRIAL_DRILL = InitUtils.setup(new ItemIndustrialDrill(), "industrial_drill"));
RebornRegistry.registerItem(TRContent.INDUSTRIAL_CHAINSAW = InitUtils.setup(new ItemIndustrialChainsaw(), "industrial_chainsaw"));
RebornRegistry.registerItem(TRContent.INDUSTRIAL_JACKHAMMER = InitUtils.setup(new ItemIndustrialJackhammer(), "industrial_jackhammer"));
RebornRegistry.registerItem(TRContent.NANOSABER = InitUtils.setup(new ItemNanosaber(), "nanosaber"));
RebornRegistry.registerItem(TRContent.OMNI_TOOL = InitUtils.setup(new ItemOmniTool(), "omni_tool"));
RebornRegistry.registerItem(TRContent.INDUSTRIAL_DRILL = InitUtils.setup(new IndustrialDrillItem(), "industrial_drill"));
RebornRegistry.registerItem(TRContent.INDUSTRIAL_CHAINSAW = InitUtils.setup(new IndustrialChainsawItem(), "industrial_chainsaw"));
RebornRegistry.registerItem(TRContent.INDUSTRIAL_JACKHAMMER = InitUtils.setup(new IndustrialJackhammerItem(), "industrial_jackhammer"));
RebornRegistry.registerItem(TRContent.NANOSABER = InitUtils.setup(new NanosaberItem(), "nanosaber"));
RebornRegistry.registerItem(TRContent.OMNI_TOOL = InitUtils.setup(new OmniToolItem(), "omni_tool"));
// Armor
RebornRegistry.registerItem(TRContent.CLOAKING_DEVICE = InitUtils.setup(new ItemCloakingDevice(), "cloaking_device"));
@ -228,7 +228,7 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.FREQUENCY_TRANSMITTER = InitUtils.setup(new ItemFrequencyTransmitter(), "frequency_transmitter"));
RebornRegistry.registerItem(TRContent.SCRAP_BOX = InitUtils.setup(new ItemScrapBox(), "scrap_box"));
RebornRegistry.registerItem(TRContent.MANUAL = InitUtils.setup(new ItemManual(), "manual"));
RebornRegistry.registerItem(TRContent.DEBUG_TOOL = InitUtils.setup(new ItemDebugTool(), "debug_tool"));
RebornRegistry.registerItem(TRContent.DEBUG_TOOL = InitUtils.setup(new DebugToolItem(), "debug_tool"));
RebornRegistry.registerItem(TRContent.CELL = InitUtils.setup(new ItemDynamicCell(), "cell"));
TechReborn.LOGGER.debug("TechReborns Items Loaded");

View file

@ -241,8 +241,8 @@ public class TRContent {
block = new BlockSolarPanel(this);
this.generationRateD = generationRateD;
this.generationRateN = generationRateN;
// Buffer for 2 mins of work
internalCapacity = generationRateD * 2_400;
internalCapacity = generationRateD * TechRebornConfig.solarInternalCapacityMultiplier;
InitUtils.setup(block, name + "_solar_panel");
}

View file

@ -47,16 +47,15 @@ import techreborn.TechReborn;
import javax.annotation.Nullable;
import java.util.Random;
public class ItemChainsaw extends AxeItem implements EnergyHolder, ItemDurabilityExtensions {
public class ChainsawItem extends AxeItem implements EnergyHolder, ItemDurabilityExtensions {
public int maxCharge = 1;
public int maxCharge;
public int cost = 250;
public float poweredSpeed = 20F;
public float unpoweredSpeed = 2.0F;
public int transferLimit = 100;
public boolean isBreaking = false;
public ItemChainsaw(ToolMaterials material, int energyCapacity, float unpoweredSpeed) {
public ChainsawItem(ToolMaterials material, int energyCapacity, float unpoweredSpeed) {
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.maxCharge = energyCapacity;

View file

@ -45,9 +45,9 @@ import java.util.Map.Entry;
/**
* Created by Mark on 20/03/2016.
*/
public class ItemDebugTool extends Item {
public class DebugToolItem extends Item {
public ItemDebugTool() {
public DebugToolItem() {
super(new Item.Settings().group(TechReborn.ITEMGROUP));
}

View file

@ -42,20 +42,22 @@ import techreborn.TechReborn;
import java.util.Random;
public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
public int maxCharge = 1;
public int maxCharge;
public int cost = 250;
public float unpoweredSpeed = 2.0F;
public float unpoweredSpeed;
public float poweredSpeed;
public int transferLimit = 100;
public ItemDrill(ToolMaterial material, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) {
public DrillItem(ToolMaterial material, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) {
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.maxCharge = energyCapacity;
this.unpoweredSpeed = unpoweredSpeed;
this.poweredSpeed = efficiencyOnProperMaterial;
}
// ItemPickaxe
// PickaxeItem
@Override
public float getMiningSpeed(ItemStack stack, BlockState state) {
if (Energy.of(stack).getEnergy() < cost) {
@ -63,7 +65,7 @@ public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabili
}
if (Items.WOODEN_PICKAXE.getMiningSpeed(stack, state) > 1.0F
|| Items.WOODEN_SHOVEL.getMiningSpeed(stack, state) > 1.0F) {
return miningSpeed;
return poweredSpeed;
} else {
return super.getMiningSpeed(stack, state);
}
@ -90,6 +92,12 @@ public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabili
return false;
}
@Override
public boolean isDamageable() {
return false;
}
// ItemDurabilityExtensions
@Override
public double getDurability(ItemStack stack) {
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
@ -105,7 +113,7 @@ public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabili
return PowerSystem.getDisplayPower().colour;
}
// IEnergyItemInfo
// EnergyHolder
@Override
public double getMaxStoredPower() {
return maxCharge;

View file

@ -46,18 +46,18 @@ import techreborn.TechReborn;
import java.util.Random;
public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
public int maxCharge = 1;
public int maxCharge;
public int cost = 250;
public int transferLimit = 100;
public int transferLimit = EnergyTier.MEDIUM.getMaxInput();
public ItemJackhammer(ToolMaterials material, int energyCapacity) {
public JackhammerItem(ToolMaterials material, int energyCapacity) {
super(material, (int) material.getAttackDamage(), 1f, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.maxCharge = energyCapacity;
}
// ItemPickaxe
// PickaxeItem
@Override
public float getMiningSpeed(ItemStack stack, BlockState state) {
if (state.getMaterial() == Material.STONE && Energy.of(stack).getEnergy() >= cost) {
@ -67,7 +67,7 @@ public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDur
}
}
// ItemTool
// MiningToolItem
@Override
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Random rand = new Random();
@ -78,17 +78,17 @@ public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDur
}
@Override
public boolean postHit(ItemStack itemstack, LivingEntity entityliving, LivingEntity entityliving1) {
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
return true;
}
// Item
// ToolItem
@Override
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
public boolean canRepair(ItemStack stack, ItemStack ingredient) {
return false;
}
// ItemDurabilityExtensions
@Override
public double getDurability(ItemStack stack) {
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
@ -104,7 +104,7 @@ public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDur
return PowerSystem.getDisplayPower().colour;
}
// IEnergyItemInfo
// EnergyHolder
@Override
public double getMaxStoredPower() {
return maxCharge;

View file

@ -27,9 +27,9 @@ package techreborn.items.tool;
import net.minecraft.item.Item;
import techreborn.TechReborn;
public class ItemTreeTap extends Item {
public class TreeTapItem extends Item {
public ItemTreeTap() {
public TreeTapItem() {
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(20));
}
}

View file

@ -37,9 +37,9 @@ import techreborn.TechReborn;
/**
* Created by modmuss50 on 26/02/2016.
*/
public class ItemWrench extends Item implements IToolHandler {
public class WrenchItem extends Item implements IToolHandler {
public ItemWrench() {
public WrenchItem() {
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}

View file

@ -34,15 +34,15 @@ import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemChainsaw;
import techreborn.items.tool.ChainsawItem;
import techreborn.utils.InitUtils;
public class ItemAdvancedChainsaw extends ItemChainsaw {
public class AdvancedChainsawItem extends ChainsawItem {
// 400k max charge with 1k charge rate
public ItemAdvancedChainsaw() {
public AdvancedChainsawItem() {
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedChainsawCharge, 1.0F);
this.cost = 250;
this.cost = 100;
this.transferLimit = 1000;
}

View file

@ -34,15 +34,15 @@ import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemDrill;
import techreborn.items.tool.DrillItem;
import techreborn.utils.InitUtils;
public class ItemAdvancedDrill extends ItemDrill {
public class AdvancedDrillItem extends DrillItem {
// 400k max charge with 1k charge rate
public ItemAdvancedDrill() {
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedDrillCharge, 0.5F, 15F);
this.cost = 250;
public AdvancedDrillItem() {
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedDrillCharge, 0.5F, 12F);
this.cost = 100;
this.transferLimit = 1000;
}

View file

@ -32,13 +32,13 @@ import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemJackhammer;
import techreborn.items.tool.JackhammerItem;
import techreborn.utils.InitUtils;
public class ItemAdvancedJackhammer extends ItemJackhammer {
public class AdvancedJackhammerItem extends JackhammerItem {
// 400k max charge with 1k charge rate
public ItemAdvancedJackhammer() {
public AdvancedJackhammerItem() {
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedJackhammerCharge);
this.cost = 100;
this.transferLimit = 1000;

View file

@ -48,14 +48,14 @@ import techreborn.init.TRContent;
import java.util.Random;
public class ItemRockCutter extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
public class RockCutterItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
public static final int maxCharge = TechRebornConfig.rockCutterCharge;
public int transferLimit = 1_000;
public int cost = 500;
// 400k FE with 1k FE\t charge rate
public ItemRockCutter() {
public RockCutterItem() {
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}

View file

@ -34,12 +34,12 @@ import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemChainsaw;
import techreborn.items.tool.ChainsawItem;
import techreborn.utils.InitUtils;
public class ItemBasicChainsaw extends ItemChainsaw {
public class BasicChainsawItem extends ChainsawItem {
public ItemBasicChainsaw() {
public BasicChainsawItem() {
super(ToolMaterials.IRON, TechRebornConfig.basicChainsawCharge, 0.5F);
this.cost = 50;
}

View file

@ -34,12 +34,12 @@ import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemDrill;
import techreborn.items.tool.DrillItem;
import techreborn.utils.InitUtils;
public class ItemBasicDrill extends ItemDrill {
public class BasicDrillItem extends DrillItem {
public ItemBasicDrill() {
public BasicDrillItem() {
super(ToolMaterials.IRON, TechRebornConfig.basicDrillCharge, 0.5F, 10F);
this.cost = 50;
}

View file

@ -32,12 +32,12 @@ import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemJackhammer;
import techreborn.items.tool.JackhammerItem;
import techreborn.utils.InitUtils;
public class ItemBasicJackhammer extends ItemJackhammer {
public class BasicJackhammerItem extends JackhammerItem {
public ItemBasicJackhammer() {
public BasicJackhammerItem() {
super(ToolMaterials.DIAMOND, TechRebornConfig.basicJackhammerCharge);
this.cost = 50;
}

View file

@ -42,12 +42,12 @@ import techreborn.utils.InitUtils;
/**
* Created by modmuss50 on 05/11/2016.
*/
public class ItemElectricTreetap extends Item implements EnergyHolder, ItemDurabilityExtensions {
public class ElectricTreetapItem extends Item implements EnergyHolder, ItemDurabilityExtensions {
public static final int maxCharge = 10_000;
public int cost = 20;
public ItemElectricTreetap() {
public ElectricTreetapItem() {
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}

View file

@ -49,7 +49,7 @@ import reborncore.common.util.ItemUtils;
import team.reborn.energy.Energy;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemChainsaw;
import techreborn.items.tool.ChainsawItem;
import techreborn.utils.InitUtils;
import techreborn.utils.MessageIDs;
import techreborn.utils.TagUtils;
@ -58,13 +58,13 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class ItemIndustrialChainsaw extends ItemChainsaw {
public class IndustrialChainsawItem extends ChainsawItem {
private static final Direction[] SEARCH_ORDER = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST, Direction.UP};
// 4M FE max charge with 1k charge rate
public ItemIndustrialChainsaw() {
public IndustrialChainsawItem() {
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialChainsawCharge, 1.0F);
this.cost = 250;
this.transferLimit = 1000;
@ -136,7 +136,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive")));
}
} else {
stack.getTag().putBoolean("isActive", false);
stack.getOrCreateTag().putBoolean("isActive", false);
if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
@ -157,7 +157,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating")));
}
stack.getTag().putBoolean("isActive", false);
stack.getOrCreateTag().putBoolean("isActive", false);
}
}

View file

@ -52,7 +52,7 @@ import reborncore.common.util.ItemUtils;
import team.reborn.energy.Energy;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemDrill;
import techreborn.items.tool.DrillItem;
import techreborn.utils.InitUtils;
import techreborn.utils.MessageIDs;
@ -62,17 +62,17 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ItemIndustrialDrill extends ItemDrill {
public class IndustrialDrillItem extends DrillItem {
// 4M FE max charge with 1k charge rate
public ItemIndustrialDrill() {
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialDrillCharge, 2.0F, 10F);
public IndustrialDrillItem() {
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialDrillCharge, 2.0F, 15F);
this.cost = 250;
this.transferLimit = 1000;
}
private Set<BlockPos> getTargetBlocks(World worldIn, BlockPos pos, @Nullable PlayerEntity playerIn) {
Set<BlockPos> targetBlocks = new HashSet<BlockPos>();
Set<BlockPos> targetBlocks = new HashSet<>();
if (playerIn == null) {
return new HashSet<>();
}
@ -124,7 +124,6 @@ public class ItemIndustrialDrill extends ItemDrill {
blockState.getBlock().onBlockRemoved(blockState, world, pos, blockState, true);
blockState.getBlock().afterBreak(world, playerIn, pos, blockState, world.getBlockEntity(pos), drill);
world.setBlockState(pos, Blocks.AIR.getDefaultState());
world.removeBlockEntity(pos);
}
}
@ -144,14 +143,10 @@ public class ItemIndustrialDrill extends ItemDrill {
return false;
}
float originalHardness = worldIn.getBlockState(originalPos).getHardness(worldIn, originalPos);
if ((originalHardness / blockHardness) > 10.0F) {
return false;
}
return true;
return !((originalHardness / blockHardness) > 10.0F);
}
// ItemDrill
// DrillItem
@Override
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
PlayerEntity playerIn = null;
@ -166,6 +161,13 @@ public class ItemIndustrialDrill extends ItemDrill {
return super.postMine(stack, worldIn, blockIn, pos, entityLiving);
}
// PickaxeItem
@Override
public boolean isEffectiveOn(BlockState blockIn) {
return (Items.DIAMOND_PICKAXE.isEffectiveOn(blockIn) || Items.DIAMOND_SHOVEL.isEffectiveOn(blockIn)) && !Items.DIAMOND_AXE.isEffectiveOn(blockIn);
}
// Item
@Override
public TypedActionResult<ItemStack> use(final World world, final PlayerEntity player, final Hand hand) {
final ItemStack stack = player.getStackInHand(hand);
@ -179,14 +181,14 @@ public class ItemIndustrialDrill extends ItemDrill {
if (stack.getTag() == null) {
stack.setTag(new CompoundTag());
}
stack.getTag().putBoolean("isActive", true);
stack.getOrCreateTag().putBoolean("isActive", true);
if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive")));
}
} else {
stack.getTag().putBoolean("isActive", false);
stack.getOrCreateTag().putBoolean("isActive", false);
if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
@ -207,7 +209,7 @@ public class ItemIndustrialDrill extends ItemDrill {
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating")));
}
stack.getTag().putBoolean("isActive", false);
stack.getOrCreateTag().putBoolean("isActive", false);
}
}
@ -221,13 +223,6 @@ public class ItemIndustrialDrill extends ItemDrill {
}
}
// ItemPickaxe
@Override
public boolean isEffectiveOn(BlockState blockIn) {
return (Items.DIAMOND_PICKAXE.isEffectiveOn(blockIn) || Items.DIAMOND_SHOVEL.isEffectiveOn(blockIn)) && !Items.DIAMOND_AXE.isEffectiveOn(blockIn);
}
// Item
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {

View file

@ -32,13 +32,13 @@ import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemJackhammer;
import techreborn.items.tool.JackhammerItem;
import techreborn.utils.InitUtils;
public class ItemIndustrialJackhammer extends ItemJackhammer {
public class IndustrialJackhammerItem extends JackhammerItem {
// 4M FE max charge with 1k charge rate
public ItemIndustrialJackhammer() {
public IndustrialJackhammerItem() {
super(ToolMaterials.IRON, TechRebornConfig.industrialJackhammerCharge);
this.cost = 250;
this.transferLimit = 1000;

View file

@ -59,13 +59,13 @@ import techreborn.utils.MessageIDs;
import javax.annotation.Nullable;
import java.util.List;
public class ItemNanosaber extends SwordItem implements EnergyHolder, ItemDurabilityExtensions, ItemStackModifiers {
public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabilityExtensions, ItemStackModifiers {
public static final int maxCharge = TechRebornConfig.nanoSaberCharge;
public int transferLimit = 1_000;
public int cost = 250;
// 4M FE max charge with 1k charge rate
public ItemNanosaber() {
public NanosaberItem() {
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.addPropertyGetter(new Identifier("techreborn:active"), new ItemPropertyGetter() {
@Override

View file

@ -55,7 +55,7 @@ import techreborn.utils.InitUtils;
import javax.annotation.Nullable;
import java.util.List;
public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
public class OmniToolItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
public static final int maxCharge = TechRebornConfig.omniToolCharge;
public int transferLimit = 1_000;
@ -63,11 +63,11 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
public int hitCost = 125;
// 4M FE max charge with 1k charge rate
public ItemOmniTool() {
public OmniToolItem() {
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}
// ItemPickaxe
// PickaxeItem
@Override
public boolean isEffectiveOn(BlockState state) {
return Items.DIAMOND_AXE.isEffectiveOn(state) || Items.DIAMOND_SWORD.isEffectiveOn(state)
@ -75,34 +75,21 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
|| Items.SHEARS.isEffectiveOn(state);
}
// ItemTool
@Override
public float getMiningSpeed(ItemStack stack, BlockState state) {
if (Energy.of(stack).getEnergy() >= cost) {
return ToolMaterials.DIAMOND.getMiningSpeed();
}
return super.getMiningSpeed(stack, state);
}
// MiningToolItem
@Override
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Energy.of(stack).use(cost);
return true;
}
// @Override
// public float getDigSpeed(ItemStack stack, IBlockState state) {
// IEnergyStorage capEnergy = stack.getCapability(CapabilityEnergy.ENERGY, null);
// if (capEnergy.getEnergyStored() >= cost) {
// capEnergy.extractEnergy(cost, false);
// return 5.0F;
// }
//
// if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F
// || Items.wooden_sword.getDigSpeed(stack, state) > 1.0F
// || Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F
// || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F
// || Items.shears.getDigSpeed(stack, state) > 1.0F) {
// return efficiencyOnProperMaterial;
// } else {
// return super.getDigSpeed(stack, state);
// }
// }
@Override
public boolean postHit(ItemStack stack, LivingEntity entityliving, LivingEntity attacker) {
if(Energy.of(stack).use(hitCost)) {
@ -111,24 +98,34 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
return false;
}
// ToolItem
@Override
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
return false;
}
// Item
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
return TorchHelper.placeTorch(context);
}
@Environment(EnvType.CLIENT)
@Override
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
return false;
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED));
// TODO
// Remember to remove WIP override and imports once complete
tooltip.add(new LiteralText(Formatting.YELLOW + "Swiss Army Knife"));
}
// ItemDurabilityExtensions
@Override
public double getDurability(ItemStack stack) {
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
@ -144,17 +141,7 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
return PowerSystem.getDisplayPower().colour;
}
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(
ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList);
}
// IEnergyItemInfo
// EnergyHolder
@Override
public double getMaxStoredPower() {
return maxCharge;

View file

@ -601,6 +601,9 @@
"techreborn.message.nanosaberInactive": "Inactive",
"techreborn.message.nanosaberEnergyErrorTo": "Not Enough Energy to",
"techreborn.message.nanosaberEnergyError": "Not Enough Energy:",
"techreborn.message.daygen": "Panel in direct sunlight",
"techreborn.message.nightgen": "Panel in reduced sunlight",
"techreborn.message.zerogen": "Panel obstructed from sky",
"keys.techreborn.category": "TechReborn Category",
"keys.techreborn.config": "Config",
@ -611,6 +614,7 @@
"techreborn.jei.recipe.processing.time.1": "Time: %s ticks",
"techreborn.jei.recipe.processing.time.2": "(%s sec)",
"techreborn.jei.recipe.heat": "Heat",
"techreborn.jei.recipe.generator.total": "E total: %s",
"techreborn.jei.desc.rubberSap": "In order to get sap, you need to find a rubber tree or obtain a rubber tree sapling and proceed to grow it. Once you have obtained a rubber tree, search around for little yellowish spots on the tree. If you don't see any, just wait a bit and eventually these yellow \"sap\" spots. To harvest the sap, use a treetap and use it on the log.",
"techreborn.jei.desc.scrapBox": "Scrapboxes can be opened by either a simple use in hand, or by dispensers. That's right, just throw your scrapboxes into dispensers and give them a redstone signal, and boom! Random item!",
@ -636,7 +640,7 @@
"techreborn.tooltip.wip": "WIP Coming Soon",
"techreborn.tooltip.inventory": "Inventory",
"techreborn.tooltip.upgrades": "Upgrades",
"techreborn.tooltip.alarm": "Shift rightclick to change sound",
"techreborn.tooltip.alarm": "Shift right-click to change sound",
"techreborn.tooltip.generationRate.day": "Generation Rate Day",
"techreborn.tooltip.generationRate.night": "Generation Rate Night",
@ -649,7 +653,7 @@
"techreborn.manual.refundbtn": "Refund",
"_comment24": "Advancements",
"advancements.techreborn.root.desc": "Now that you have acquired Tech Reborn ore, you might find a tree tap usefull.",
"advancements.techreborn.root.desc": "Now that you have acquired Tech Reborn ore, you might find a tree tap useful.",
"advancements.techreborn.treetap": "TreeTap",
"advancements.techreborn.treetap.desc": "Now that you have crafted a tree tap you will want to use it on a sap spot on a rubber tree.",
"advancements.techreborn.sap": "Rubber Sap",
@ -663,7 +667,7 @@
"techreborn:chemical_reactor": "Chemical Reactor",
"techreborn:compressor": "Compressor",
"techreborn:distillation_tower": "Distillation Tower",
"techreborn:extractor": "Extrator",
"techreborn:extractor": "Extractor",
"techreborn:grinder": "Grinder",
"techreborn:implosion_compressor": "Implosion Compressor",
"techreborn:industrial_electrolyzer": "Industrial Electrolyzer",
@ -677,7 +681,12 @@
"techreborn:rolling_machine": "Rolling Machine",
"techreborn:solid_canning_machine": "Solid Canning Machine",
"techreborn:wire_mill": "Wire Mill",
"techreborn:gas_turbine": "Gas Generator",
"techreborn:semi_fluid_generator": "Semifluid Generator",
"techreborn:diesel_generator": "Diesel Generator",
"techreborn:thermal_generator": "Thermal Generator",
"techreborn:plasma_generator": "Plasma Generator",
"_comment26": "Fluid buckets",
"item.techreborn.beryllium_bucket": "Beryllium",
"item.techreborn.calcium_bucket": "Calcium",

View file

@ -2,7 +2,7 @@
"parent": "minecraft:block/cube_bottom_top",
"textures": {
"top": "techreborn:block/machines/generators/quantum_solar_panel_top",
"bottom": "techreborn:block/machines/generators/generator_bottom",
"side": "techreborn:block/machines/generators/solar_panel_side_off"
"bottom": "techreborn:block/machines/tier3_machines/quantum_chest_bottom",
"side": "techreborn:block/machines/generators/quantum_solar_panel_side_off"
}
}

View file

@ -2,7 +2,7 @@
"parent": "minecraft:block/cube_bottom_top",
"textures": {
"top": "techreborn:block/machines/generators/quantum_solar_panel_top",
"bottom": "techreborn:block/machines/generators/generator_bottom",
"side": "techreborn:block/machines/generators/solar_panel_side_on"
"bottom": "techreborn:block/machines/tier3_machines/quantum_chest_bottom",
"side": "techreborn:block/machines/generators/quantum_solar_panel_side_on"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "techreborn:wire_mill"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,22 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"DLD",
"LDL",
"CPC"
"AAA",
"ABA",
"AAA"
],
"key": {
"P": {
"A": {
"item": "techreborn:ultimate_solar_panel"
},
"C": {
"item": "techreborn:energy_flow_chip"
},
"D": {
"tag": "c:diamond_dust"
},
"L": {
"item": "techreborn:reinforced_glass"
"B": {
"item": "techreborn:uu_matter"
}
},
"result": {

View file

@ -1,25 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"DLD",
"LDL",
"CPC"
],
"key": {
"P": {
"item": "techreborn:industrial_machine_frame"
},
"C": {
"item": "techreborn:energy_flow_chip"
},
"D": {
"tag": "c:diamond_dust"
},
"L": {
"item": "techreborn:reinforced_glass"
}
},
"result": {
"item": "techreborn:quantum_solar_panel"
}
}

View file

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"D ",
" C ",
" S"
],
"key": {
"D": {
"item": "techreborn:advanced_drill"
},
"C": {
"item": "techreborn:advanced_chainsaw"
},
"S": {
"item": "minecraft:diamond_sword"
}
},
"result": {
"item": "techreborn:omni_tool"
}
}