Merge remote-tracking branch 'remotes/origin/1.14' into 1.15
|
@ -48,7 +48,7 @@ repositories {
|
|||
}
|
||||
}
|
||||
|
||||
version = "3.0.11"
|
||||
version = "3.0.12"
|
||||
|
||||
configurations {
|
||||
shade
|
||||
|
|
|
@ -24,16 +24,21 @@
|
|||
|
||||
package techreborn.api.recipe.recipes;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.recipe.ShapedRecipe;
|
||||
import net.minecraft.tag.ItemTags;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
|
@ -53,8 +58,9 @@ public class RollingMachineRecipe extends RebornRecipe {
|
|||
|
||||
@Override
|
||||
public void deserialize(JsonObject jsonObject) {
|
||||
shaped = JsonHelper.getObject(jsonObject, "shaped");
|
||||
shapedRecipe = RecipeSerializer.SHAPED.read(getId(), shaped);
|
||||
JsonObject json = JsonHelper.getObject(jsonObject, "shaped");
|
||||
shapedRecipe = RecipeSerializer.SHAPED.read(getId(), json);
|
||||
shaped = withoutTags(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,6 +68,27 @@ public class RollingMachineRecipe extends RebornRecipe {
|
|||
jsonObject.add("shaped", shaped);
|
||||
}
|
||||
|
||||
//This needs to be done to remove the item tags, and replace them with just items for when syncing to the server
|
||||
private JsonObject withoutTags(JsonObject jsonObject) {
|
||||
JsonObject key = jsonObject.get("key").getAsJsonObject();
|
||||
key.entrySet().forEach(entry -> {
|
||||
if(entry.getValue().isJsonObject()){
|
||||
JsonObject value = entry.getValue().getAsJsonObject();
|
||||
if(value.has("tag")){
|
||||
|
||||
Identifier tag = new Identifier(value.get("tag").getAsString());
|
||||
Tag<Item> itemTag = ItemTags.getContainer().get(tag);
|
||||
Item item = Iterables.get(itemTag.values(), 0);
|
||||
|
||||
//Remove the tag, and replace it with a basic s
|
||||
value.remove("tag");
|
||||
value.addProperty("item", Registry.ITEM.getId(item).toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultedList<RebornIngredient> getRebornIngredients() {
|
||||
return DefaultedList.of();
|
||||
|
|
|
@ -68,14 +68,14 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
checkTier();
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter != null && crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
// PowerAcceptorBlockEntity
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
@ -115,7 +115,7 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
return new ItemStack(toolDrop, 1);
|
||||
}
|
||||
|
||||
// ItemHandlerProvider
|
||||
// InventoryProvider
|
||||
@Override
|
||||
public RebornInventory<?> getInventory() {
|
||||
return inventory;
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
package techreborn.blockentity.machine.iron;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
||||
public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop {
|
||||
|
||||
public RebornInventory<?> inventory;
|
||||
public int burnTime;
|
||||
public int totalBurnTime;
|
||||
public int progress;
|
||||
public int totalCookingTime;
|
||||
int fuelSlot;
|
||||
Block toolDrop;
|
||||
boolean active = false;
|
||||
|
||||
public AbstractIronMachineBlockEntity(BlockEntityType<?> blockEntityTypeIn, int fuelSlot, Block toolDrop) {
|
||||
super(blockEntityTypeIn);
|
||||
this.fuelSlot = fuelSlot;
|
||||
// default value for vanilla smelting recipes is 200
|
||||
this.totalCookingTime = (int) (200 / TechRebornConfig.cookingScale);
|
||||
this.toolDrop = toolDrop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that we have all inputs and can put output into slot
|
||||
* @return
|
||||
*/
|
||||
protected abstract boolean canSmelt();
|
||||
|
||||
/**
|
||||
* Turn ingredients into the appropriate smelted
|
||||
* item in the output slot
|
||||
*/
|
||||
protected abstract void smelt();
|
||||
|
||||
/**
|
||||
* Returns the number of ticks that the supplied fuel item will keep the
|
||||
* furnace burning, or 0 if the item isn't fuel
|
||||
* @param stack Itemstack of fuel
|
||||
* @return Integer Number of ticks
|
||||
*/
|
||||
private int getItemBurnTime(ItemStack stack) {
|
||||
if (stack.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
return (int) (AbstractFurnaceBlockEntity.createFuelTimeMap().getOrDefault(stack.getItem(), 0) * TechRebornConfig.fuelScale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns remaining fraction of fuel burn time
|
||||
* @param scale Scale to use for burn time
|
||||
* @return int scaled remaining fuel burn time
|
||||
*/
|
||||
public int getBurnTimeRemainingScaled(int scale) {
|
||||
if (totalBurnTime == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return burnTime * scale / totalBurnTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns crafting progress
|
||||
* @param scale Scale to use for crafting progress
|
||||
* @return int Scaled crafting progress
|
||||
*/
|
||||
public int getProgressScaled(int scale) {
|
||||
if (totalCookingTime > 0) {
|
||||
return progress * scale / totalCookingTime;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if Iron Machine is burning fuel thus can do work
|
||||
* @return Boolean True if machine is burning
|
||||
*/
|
||||
public boolean isBurning() {
|
||||
return burnTime > 0;
|
||||
}
|
||||
|
||||
private void updateState() {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() instanceof BlockMachineBase) {
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) state.getBlock();
|
||||
if (state.get(BlockMachineBase.ACTIVE) != burnTime > 0)
|
||||
blockMachineBase.setActive(burnTime > 0, world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
// MachineBaseBlockEntity
|
||||
@Override
|
||||
public void fromTag(CompoundTag compoundTag) {
|
||||
super.fromTag(compoundTag);
|
||||
burnTime = compoundTag.getInt("BurnTime");
|
||||
totalBurnTime = compoundTag.getInt("TotalBurnTime");
|
||||
progress = compoundTag.getInt("Progress");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag compoundTag) {
|
||||
super.toTag(compoundTag);
|
||||
compoundTag.putInt("BurnTime", burnTime);
|
||||
compoundTag.putInt("TotalBurnTime", totalBurnTime);
|
||||
compoundTag.putInt("Progress", progress);
|
||||
return compoundTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if(world.isClient){
|
||||
return;
|
||||
}
|
||||
boolean isBurning = isBurning();
|
||||
if (isBurning) {
|
||||
--burnTime;
|
||||
}
|
||||
|
||||
if (!isBurning && canSmelt()) {
|
||||
burnTime = totalBurnTime = getItemBurnTime(inventory.getInvStack(fuelSlot));
|
||||
if (burnTime > 0) {
|
||||
// Fuel slot
|
||||
ItemStack fuelStack = inventory.getInvStack(fuelSlot);
|
||||
if (fuelStack.getItem().hasRecipeRemainder()) {
|
||||
inventory.setInvStack(fuelSlot, new ItemStack(fuelStack.getItem().getRecipeRemainder()));
|
||||
} else if (fuelStack.getCount() > 1) {
|
||||
inventory.shrinkSlot(fuelSlot, 1);
|
||||
} else if (fuelStack.getCount() == 1) {
|
||||
inventory.setInvStack(fuelSlot, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isBurning() && canSmelt()) {
|
||||
++progress;
|
||||
if (progress == totalCookingTime) {
|
||||
progress = 0;
|
||||
smelt();
|
||||
}
|
||||
} else {
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
if (isBurning != isBurning()) {
|
||||
inventory.setChanged();
|
||||
updateState();
|
||||
}
|
||||
if (inventory.hasChanged()) {
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// InventoryProvider
|
||||
@Override
|
||||
public RebornInventory<?> getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return new ItemStack(toolDrop);
|
||||
}
|
||||
|
||||
public int getBurnTime() {
|
||||
return this.burnTime;
|
||||
}
|
||||
|
||||
public void setBurnTime(int burnTime) {
|
||||
this.burnTime = burnTime;
|
||||
}
|
||||
|
||||
public int getTotalBurnTime() {
|
||||
return this.totalBurnTime;
|
||||
}
|
||||
|
||||
public void setTotalBurnTime(int totalBurnTime) {
|
||||
this.totalBurnTime = totalBurnTime;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(int progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,18 +24,11 @@
|
|||
|
||||
package techreborn.blockentity.machine.iron;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.ingredient.RebornIngredient;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
|
@ -43,77 +36,15 @@ import techreborn.init.ModRecipes;
|
|||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
|
||||
implements IToolDrop, InventoryProvider, IContainerProvider {
|
||||
public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity implements IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public RebornInventory<IronAlloyFurnaceBlockEntity> inventory = new RebornInventory<>(4, "IronAlloyFurnaceBlockEntity", 64, this);
|
||||
public int burnTime;
|
||||
public int totalBurnTime;
|
||||
public int cookTime;
|
||||
int input1 = 0;
|
||||
int input2 = 1;
|
||||
int output = 2;
|
||||
int fuel = 3;
|
||||
|
||||
public IronAlloyFurnaceBlockEntity() {
|
||||
super(TRBlockEntities.IRON_ALLOY_FURNACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of ticks that the supplied fuel item will keep the
|
||||
* furnace burning, or 0 if the item isn't fuel
|
||||
* @param stack Itemstack of fuel
|
||||
* @return Integer Number of ticks
|
||||
*/
|
||||
public static int getItemBurnTime(ItemStack stack) {
|
||||
if (stack.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
return AbstractFurnaceBlockEntity.createFuelTimeMap().getOrDefault(stack.getItem(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if(world.isClient){
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isBurning = isBurning();
|
||||
boolean updateInventory = false;
|
||||
if (isBurning) {
|
||||
--burnTime;
|
||||
}
|
||||
if (burnTime != 0 || !inventory.getInvStack(input1).isEmpty() && !inventory.getInvStack(fuel).isEmpty()) {
|
||||
if (burnTime == 0 && canSmelt()) {
|
||||
totalBurnTime = burnTime = getItemBurnTime(inventory.getInvStack(fuel));
|
||||
if (burnTime > 0) {
|
||||
updateInventory = true;
|
||||
if (!inventory.getInvStack(fuel).isEmpty()) {
|
||||
inventory.shrinkSlot(fuel, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isBurning() && canSmelt()) {
|
||||
++cookTime;
|
||||
if (cookTime == 200) {
|
||||
cookTime = 0;
|
||||
smeltItem();
|
||||
updateInventory = true;
|
||||
}
|
||||
} else {
|
||||
cookTime = 0;
|
||||
}
|
||||
}
|
||||
if (isBurning != isBurning()) {
|
||||
updateInventory = true;
|
||||
updateState();
|
||||
}
|
||||
|
||||
if (updateInventory) {
|
||||
markDirty();
|
||||
}
|
||||
super(TRBlockEntities.IRON_ALLOY_FURNACE, 3, TRContent.Machine.IRON_ALLOY_FURNACE.block);
|
||||
this.inventory = new RebornInventory<>(4, "IronAlloyFurnaceBlockEntity", 64, this);
|
||||
}
|
||||
|
||||
public boolean hasAllInputs(RebornRecipe recipeType) {
|
||||
|
@ -133,7 +64,8 @@ public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean canSmelt() {
|
||||
@Override
|
||||
protected boolean canSmelt() {
|
||||
if (inventory.getInvStack(input1).isEmpty() || inventory.getInvStack(input2).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -155,11 +87,8 @@ public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
|
|||
return result <= inventory.getStackLimit() && result <= inventory.getInvStack(output).getMaxCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn one item from the furnace source stack into the appropriate smelted
|
||||
* item in the furnace result stack
|
||||
*/
|
||||
public void smeltItem() {
|
||||
@Override
|
||||
protected void smelt() {
|
||||
if (!canSmelt()) {
|
||||
return;
|
||||
}
|
||||
|
@ -195,87 +124,16 @@ public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Furnace isBurning
|
||||
* @return Boolean True if furnace is burning
|
||||
*/
|
||||
public boolean isBurning() {
|
||||
return burnTime > 0;
|
||||
}
|
||||
|
||||
public int getBurnTimeRemainingScaled(int scale) {
|
||||
if (totalBurnTime == 0) {
|
||||
totalBurnTime = 200;
|
||||
}
|
||||
|
||||
return burnTime * scale / totalBurnTime;
|
||||
}
|
||||
|
||||
public int getCookProgressScaled(int scale) {
|
||||
return cookTime * scale / 200;
|
||||
}
|
||||
|
||||
public void updateState() {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() instanceof BlockMachineBase) {
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) state.getBlock();
|
||||
if (state.get(BlockMachineBase.ACTIVE) != burnTime > 0)
|
||||
blockMachineBase.setActive(burnTime > 0, world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Direction getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.IRON_ALLOY_FURNACE.getStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RebornInventory<IronAlloyFurnaceBlockEntity> getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public int getBurnTime() {
|
||||
return burnTime;
|
||||
}
|
||||
|
||||
public void setBurnTime(int burnTime) {
|
||||
this.burnTime = burnTime;
|
||||
}
|
||||
|
||||
public int getTotalBurnTime() {
|
||||
return totalBurnTime;
|
||||
}
|
||||
|
||||
public void setTotalBurnTime(int currentItemBurnTime) {
|
||||
this.totalBurnTime = currentItemBurnTime;
|
||||
}
|
||||
|
||||
public int getCookTime() {
|
||||
return cookTime;
|
||||
}
|
||||
|
||||
public void setCookTime(int cookTime) {
|
||||
this.cookTime = cookTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
|
||||
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().blockEntity(this)
|
||||
.slot(0, 47, 17)
|
||||
.slot(1, 65, 17)
|
||||
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53).syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||
.syncIntegerValue(this::getCookTime, this::setCookTime)
|
||||
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create(this, syncID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53)
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||
.syncIntegerValue(this::getProgress, this::setProgress)
|
||||
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime)
|
||||
.addInventory().create(this, syncID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ package techreborn.blockentity.machine.iron;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
||||
import net.minecraft.entity.ExperienceOrbEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -35,89 +33,78 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.recipe.SmeltingRecipe;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
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.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.util.IInventoryAccess;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.RecipeUtils;
|
||||
|
||||
public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
|
||||
implements InventoryProvider, IContainerProvider {
|
||||
public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity implements IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public RebornInventory<IronFurnaceBlockEntity> inventory = new RebornInventory<>(3, "IronFurnaceBlockEntity", 64, this, getInvetoryAccess());
|
||||
public int burnTime;
|
||||
public int totalBurnTime;
|
||||
public int progress;
|
||||
public int fuelScale = 160;
|
||||
int inputSlot = 0;
|
||||
int outputSlot = 1;
|
||||
int fuelSlot = 2;
|
||||
boolean active = false;
|
||||
private float experience;
|
||||
|
||||
public float experience;
|
||||
|
||||
public IronFurnaceBlockEntity() {
|
||||
super(TRBlockEntities.IRON_FURNACE);
|
||||
super(TRBlockEntities.IRON_FURNACE, 2, TRContent.Machine.IRON_FURNACE.block);
|
||||
this.inventory = new RebornInventory<>(3, "IronFurnaceBlockEntity", 64, this);
|
||||
}
|
||||
|
||||
public static IInventoryAccess<IronFurnaceBlockEntity> getInvetoryAccess(){
|
||||
return (slotID, stack, face, direction, blockEntity) -> {
|
||||
if(direction == IInventoryAccess.AccessDirection.INSERT){
|
||||
boolean isFuel = AbstractFurnaceBlockEntity.canUseAsFuel(stack);
|
||||
if(isFuel){
|
||||
ItemStack fuelSlotStack = blockEntity.inventory.getInvStack(blockEntity.fuelSlot);
|
||||
if(fuelSlotStack.isEmpty() || ItemUtils.isItemEqual(stack, fuelSlotStack, true, true) && fuelSlotStack.getMaxCount() != fuelSlotStack.getCount()){
|
||||
return slotID == blockEntity.fuelSlot;
|
||||
}
|
||||
}
|
||||
return slotID != blockEntity.outputSlot;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public int gaugeProgressScaled(int scale) {
|
||||
return progress * scale / fuelScale;
|
||||
}
|
||||
|
||||
public int gaugeFuelScaled(int scale) {
|
||||
if (totalBurnTime == 0) {
|
||||
totalBurnTime = burnTime;
|
||||
if (totalBurnTime == 0) {
|
||||
totalBurnTime = fuelScale;
|
||||
public void handleGuiInputFromClient(PlayerEntity playerIn) {
|
||||
if (playerIn instanceof ServerPlayerEntity) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) playerIn;
|
||||
int totalExperience = (int) experience;
|
||||
while (totalExperience > 0) {
|
||||
int expToDrop = ExperienceOrbEntity.roundToOrbSize(totalExperience);
|
||||
totalExperience -= expToDrop;
|
||||
player.world.spawnEntity(new ExperienceOrbEntity(player.world, player.x, player.y + 0.5D, player.z + 0.5D, expToDrop));
|
||||
}
|
||||
}
|
||||
return burnTime * scale / totalBurnTime;
|
||||
experience = 0;
|
||||
}
|
||||
|
||||
private void cookItems() {
|
||||
private ItemStack getResultFor(ItemStack stack) {
|
||||
ItemStack result = RecipeUtils.getMatchingRecipes(world, RecipeType.SMELTING, stack);
|
||||
if (!result.isEmpty()) {
|
||||
return result.copy();
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
private float getExperienceFor(ItemStack stack) {
|
||||
Optional<SmeltingRecipe> recipe = world.getRecipeManager().getFirstMatch(RecipeType.SMELTING, this, world);
|
||||
if (recipe.isPresent()) {
|
||||
return recipe.get().getExperience();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// AbstractIronMachineBlockEntity
|
||||
@Override
|
||||
protected void smelt() {
|
||||
if (!canSmelt()) {
|
||||
return;
|
||||
}
|
||||
ItemStack inputStack = inventory.getInvStack(inputSlot);
|
||||
ItemStack outputStack = getResultFor(inputStack);
|
||||
float recipeExp = getExperienceFor(inputStack);
|
||||
ItemStack resultStack = getResultFor(inputStack);
|
||||
|
||||
if (inventory.getInvStack(outputSlot).isEmpty()) {
|
||||
inventory.setInvStack(outputSlot, outputStack.copy());
|
||||
} else if (inventory.getInvStack(outputSlot).isItemEqualIgnoreDamage(outputStack)) {
|
||||
inventory.getInvStack(outputSlot).increment(outputStack.getCount());
|
||||
inventory.setInvStack(outputSlot, resultStack.copy());
|
||||
} else if (inventory.getInvStack(outputSlot).isItemEqualIgnoreDamage(resultStack)) {
|
||||
inventory.getInvStack(outputSlot).increment(resultStack.getCount());
|
||||
}
|
||||
experience += getExperienceFor(inputStack);
|
||||
if (inputStack.getCount() > 1) {
|
||||
inventory.shrinkSlot(inputSlot, 1);
|
||||
} else {
|
||||
inventory.setInvStack(inputSlot, ItemStack.EMPTY);
|
||||
}
|
||||
experience += recipeExp;
|
||||
}
|
||||
|
||||
private boolean canSmelt() {
|
||||
|
||||
@Override
|
||||
protected boolean canSmelt() {
|
||||
if (inventory.getInvStack(inputSlot).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -131,50 +118,7 @@ public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
|
|||
int result = inventory.getInvStack(outputSlot).getCount() + outputStack.getCount();
|
||||
return result <= inventory.getStackLimit() && result <= outputStack.getMaxCount();
|
||||
}
|
||||
|
||||
public boolean isBurning() {
|
||||
return burnTime > 0;
|
||||
}
|
||||
|
||||
private ItemStack getResultFor(ItemStack stack) {
|
||||
ItemStack result = RecipeUtils.getMatchingRecipes(world, RecipeType.SMELTING, stack);
|
||||
if (!result.isEmpty()) {
|
||||
return result.copy();
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
private float getExperienceFor(ItemStack stack) {
|
||||
Optional<SmeltingRecipe> recipe = world.getRecipeManager().getFirstMatch(RecipeType.SMELTING, this, world);
|
||||
if (recipe.isPresent()) {
|
||||
return recipe.get().getExperience();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void handleGuiInputFromClient(PlayerEntity playerIn) {
|
||||
if (playerIn instanceof ServerPlayerEntity) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) playerIn;
|
||||
int totalExperience = (int) experience;
|
||||
while (totalExperience > 0) {
|
||||
int expToDrop = ExperienceOrbEntity.roundToOrbSize(totalExperience);
|
||||
totalExperience -= expToDrop;
|
||||
player.world.spawnEntity(new ExperienceOrbEntity(player.world, player.x, player.y + 0.5D, player.z + 0.5D, expToDrop));
|
||||
}
|
||||
experience = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateState() {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() instanceof BlockMachineBase) {
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) state.getBlock();
|
||||
if (state.get(BlockMachineBase.ACTIVE) != burnTime > 0)
|
||||
blockMachineBase.setActive(burnTime > 0, world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
// MachineBaseBlockEntity
|
||||
@Override
|
||||
public void fromTag(CompoundTag compoundTag) {
|
||||
super.fromTag(compoundTag);
|
||||
|
@ -188,94 +132,24 @@ public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
|
|||
return compoundTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if(world.isClient){
|
||||
return;
|
||||
}
|
||||
boolean isBurning = isBurning();
|
||||
boolean updateInventory = false;
|
||||
if (isBurning) {
|
||||
--burnTime;
|
||||
}
|
||||
|
||||
if (burnTime <= 0 && canSmelt()) {
|
||||
burnTime = totalBurnTime = (int) (AbstractFurnaceBlockEntity.createFuelTimeMap().getOrDefault(inventory.getInvStack(fuelSlot).getItem(), 0) * 1.25);
|
||||
if (burnTime > 0) {
|
||||
// Fuel slot
|
||||
ItemStack fuelStack = inventory.getInvStack(fuelSlot);
|
||||
if (fuelStack.getItem().hasRecipeRemainder()) {
|
||||
inventory.setInvStack(fuelSlot, new ItemStack(fuelStack.getItem().getRecipeRemainder()));
|
||||
} else if (fuelStack.getCount() > 1) {
|
||||
inventory.shrinkSlot(fuelSlot, 1);
|
||||
} else if (fuelStack.getCount() == 1) {
|
||||
inventory.setInvStack(fuelSlot, ItemStack.EMPTY);
|
||||
}
|
||||
updateInventory = true;
|
||||
}
|
||||
}
|
||||
if (isBurning() && canSmelt()) {
|
||||
progress++;
|
||||
if (progress >= fuelScale) {
|
||||
progress = 0;
|
||||
cookItems();
|
||||
updateInventory = true;
|
||||
}
|
||||
} else {
|
||||
progress = 0;
|
||||
}
|
||||
if (isBurning != isBurning()) {
|
||||
updateInventory = true;
|
||||
updateState();
|
||||
}
|
||||
if (updateInventory) {
|
||||
markDirty();
|
||||
}
|
||||
// IContainerProvider
|
||||
public float getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// InventoryProvider
|
||||
@Override
|
||||
public RebornInventory<IronFurnaceBlockEntity> getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
public int getBurnTime() {
|
||||
return this.burnTime;
|
||||
}
|
||||
|
||||
public void setBurnTime(int burnTime) {
|
||||
this.burnTime = burnTime;
|
||||
}
|
||||
|
||||
public int getTotalBurnTime() {
|
||||
return this.totalBurnTime;
|
||||
}
|
||||
|
||||
public void setTotalBurnTime(int totalBurnTime) {
|
||||
this.totalBurnTime = totalBurnTime;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(int progress) {
|
||||
this.progress = progress;
|
||||
public void setExperience(float experience) {
|
||||
this.experience = experience;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
|
||||
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().blockEntity(this).fuelSlot(2, 56, 53).slot(0, 56, 17).outputSlot(1, 116, 35)
|
||||
.addInventory().blockEntity(this)
|
||||
.fuelSlot(2, 56, 53).slot(0, 56, 17).outputSlot(1, 116, 35)
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||
.syncIntegerValue(this::getProgress, this::setProgress)
|
||||
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create(this, syncID);
|
||||
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime)
|
||||
.sync(this::getExperience, this::setExperience)
|
||||
.addInventory().create(this, syncID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,32 +24,42 @@
|
|||
|
||||
package techreborn.blockentity.machine.tier3;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
import reborncore.common.chunkloading.ChunkLoaderManager;
|
||||
|
||||
public class ChunkLoaderBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider, IContainerProvider {
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public RebornInventory<ChunkLoaderBlockEntity> inventory = new RebornInventory<>(1, "ChunkLoaderBlockEntity", 64, this);
|
||||
public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IToolDrop, InventoryProvider, IContainerProvider {
|
||||
|
||||
public RebornInventory<ChunkLoaderBlockEntity> inventory = new RebornInventory<>(0, "ChunkLoaderBlockEntity", 64, this);
|
||||
private int radius;
|
||||
private String ownerUdid;
|
||||
|
||||
public ChunkLoaderBlockEntity() {
|
||||
super(TRBlockEntities.CHUNK_LOADER );
|
||||
this.radius = 1;
|
||||
}
|
||||
|
||||
public void handleGuiInputFromClient(int buttonID) {
|
||||
public void handleGuiInputFromClient(int buttonID, @Nullable PlayerEntity playerEntity) {
|
||||
radius += buttonID;
|
||||
|
||||
if (radius > TechRebornConfig.chunkLoaderMaxRadius) {
|
||||
|
@ -58,17 +68,66 @@ public class ChunkLoaderBlockEntity extends PowerAcceptorBlockEntity implements
|
|||
if (radius <= 1) {
|
||||
radius = 1;
|
||||
}
|
||||
|
||||
reload();
|
||||
|
||||
if(playerEntity != null){
|
||||
ChunkLoaderManager manager = ChunkLoaderManager.get(getWorld());
|
||||
manager.syncChunkLoaderToClient((ServerPlayerEntity) playerEntity, getPos());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.CHUNK_LOADER.getStack();
|
||||
}
|
||||
|
||||
|
||||
private void reload(){
|
||||
unloadAll();
|
||||
load();
|
||||
}
|
||||
|
||||
private void load(){
|
||||
ChunkLoaderManager manager = ChunkLoaderManager.get(getWorld());
|
||||
ChunkPos rootPos = getChunkPos();
|
||||
int loadRadius = radius -1;
|
||||
for (int i = -loadRadius; i <= loadRadius; i++) {
|
||||
for (int j = -loadRadius; j <= loadRadius; j++) {
|
||||
ChunkPos loadPos = new ChunkPos(rootPos.x + i, rootPos.z + j);
|
||||
|
||||
if(!manager.isChunkLoaded(getWorld(), loadPos, getPos())){
|
||||
manager.loadChunk(getWorld(), loadPos, getPos(), ownerUdid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
// TODO: chunkload
|
||||
public void onBreak(World world, PlayerEntity playerEntity, BlockPos blockPos, BlockState blockState) {
|
||||
if(world.isClient){
|
||||
return;
|
||||
}
|
||||
unloadAll();
|
||||
ChunkLoaderManager.get(world).clearClient((ServerPlayerEntity) playerEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlace(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
|
||||
if(world.isClient){
|
||||
return;
|
||||
}
|
||||
ownerUdid = placer.getUuidAsString();
|
||||
reload();
|
||||
}
|
||||
|
||||
private void unloadAll(){
|
||||
ChunkLoaderManager manager = ChunkLoaderManager.get(world);
|
||||
manager.unloadChunkLoader(world, getPos());
|
||||
}
|
||||
|
||||
public ChunkPos getChunkPos(){
|
||||
return new ChunkPos(getPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,39 +142,18 @@ public class ChunkLoaderBlockEntity extends PowerAcceptorBlockEntity implements
|
|||
public void fromTag(CompoundTag nbttagcompound) {
|
||||
super.fromTag(nbttagcompound);
|
||||
this.radius = nbttagcompound.getInt("radius");
|
||||
this.ownerUdid = nbttagcompound.getString("ownerUdid");
|
||||
if(!StringUtils.isBlank(ownerUdid)){
|
||||
nbttagcompound.putString("ownerUdid", this.ownerUdid);
|
||||
}
|
||||
inventory.read(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return TechRebornConfig.chunkLoaderMaxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return TechRebornConfig.chunkLoaderMaxInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RebornInventory<ChunkLoaderBlockEntity> getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
|
||||
public int getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
@ -127,6 +165,7 @@ public class ChunkLoaderBlockEntity extends PowerAcceptorBlockEntity implements
|
|||
@Override
|
||||
public BuiltContainer createContainer(int syncID, PlayerEntity player) {
|
||||
return new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.blockEntity(this).energySlot(0, 8, 72).syncEnergyValue().syncIntegerValue(this::getRadius, this::setRadius).addInventory().create(this, syncID);
|
||||
.blockEntity(this).syncIntegerValue(this::getRadius, this::setRadius).addInventory().create(this, syncID);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,6 +66,9 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
if (!inventory.getInvStack(0).isEmpty()) {
|
||||
ItemStack stack = inventory.getInvStack(0);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
|
|||
@Override
|
||||
public CompoundTag toTag(CompoundTag nbttagcompound) {
|
||||
super.toTag(nbttagcompound);
|
||||
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
|
||||
if (ownerUdid == null || StringUtils.isEmpty(ownerUdid)) {
|
||||
return nbttagcompound;
|
||||
}
|
||||
nbttagcompound.putString("ownerUdid", this.ownerUdid);
|
||||
|
|
|
@ -24,10 +24,8 @@
|
|||
|
||||
package techreborn.blocks.misc;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.WoodButtonBlock;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
|
@ -36,6 +34,6 @@ import net.minecraft.sound.BlockSoundGroup;
|
|||
public class RubberButtonBlock extends WoodButtonBlock {
|
||||
|
||||
public RubberButtonBlock() {
|
||||
super(FabricBlockSettings.of(Material.PART).noCollision().strength(0.5f, 0.5f).sounds(BlockSoundGroup.WOOD).build());
|
||||
super(InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
|
||||
package techreborn.blocks.misc;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
|
@ -37,6 +34,6 @@ import net.minecraft.sound.BlockSoundGroup;
|
|||
public class RubberDoorBlock extends DoorBlock {
|
||||
|
||||
public RubberDoorBlock() {
|
||||
super(FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE).strength(3.0f, 3.0f).sounds(BlockSoundGroup.WOOD).build());
|
||||
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
|
||||
package techreborn.blocks.misc;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.block.PressurePlateBlock;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
|
@ -37,7 +34,7 @@ import net.minecraft.sound.BlockSoundGroup;
|
|||
public class RubberPressurePlateBlock extends PressurePlateBlock {
|
||||
|
||||
public RubberPressurePlateBlock() {
|
||||
super(PressurePlateBlock.ActivationRule.EVERYTHING, FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE).noCollision().strength(0.5f, 0.5f).sounds(BlockSoundGroup.WOOD).build());
|
||||
super(PressurePlateBlock.ActivationRule.EVERYTHING, InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
|
||||
package techreborn.blocks.misc;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.block.TrapdoorBlock;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
|
@ -37,7 +34,6 @@ import net.minecraft.sound.BlockSoundGroup;
|
|||
public class RubberTrapdoorBlock extends TrapdoorBlock {
|
||||
|
||||
public RubberTrapdoorBlock() {
|
||||
super(FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE).strength(3f, 3f).sounds(BlockSoundGroup.WOOD).build());
|
||||
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
|
@ -43,6 +44,15 @@ public class GuiAESU extends GuiBase<BuiltContainer> {
|
|||
super(player, aesu, aesu.createContainer(syncID, player));
|
||||
this.blockEntity = aesu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
addButton(new GuiButtonUpDown(left + 121, top + 79, this, b -> onClick(256), UpDownButtonType.FASTFORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 12, top + 79, this, b -> onClick(64), UpDownButtonType.FORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 24, top + 79, this, b -> onClick(-64), UpDownButtonType.REWIND));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 36, top + 79, this, b -> onClick(-256), UpDownButtonType.FASTREWIND));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
|
||||
|
@ -53,7 +63,6 @@ public class GuiAESU extends GuiBase<BuiltContainer> {
|
|||
this.drawSlot(98, 45, layer);
|
||||
this.drawArmourSlots(8, 18, layer);
|
||||
this.builder.drawEnergyOutput(this, 155, 61, this.blockEntity.getCurrentOutput(), layer);
|
||||
this.builder.drawUpDownButtons(this, 121, 79, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,13 +80,6 @@ public class GuiAESU extends GuiBase<BuiltContainer> {
|
|||
}
|
||||
|
||||
builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
|
||||
addButton(new GuiButtonUpDown(left + 121, top + 79, this, b -> onClick(256)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 12, top + 79, this, b -> onClick(64)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 24, top + 79, this, b -> onClick(-64)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 36, top + 79, this, b -> onClick(-256)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onClick(int amount){
|
||||
|
|
|
@ -42,7 +42,6 @@ public class GuiAlloyFurnace extends GuiBase<BuiltContainer> {
|
|||
@Override
|
||||
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
|
||||
super.drawBackground(lastFrameDuration, mouseX, mouseY);
|
||||
|
||||
GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
// Input slots
|
||||
|
@ -59,13 +58,7 @@ public class GuiAlloyFurnace extends GuiBase<BuiltContainer> {
|
|||
super.drawForeground(mouseX, mouseY);
|
||||
GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
builder.drawProgressBar(this, blockEntity.getCookProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
|
||||
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
|
||||
builder.drawBurnBar(this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float lastFrameDuration) {
|
||||
super.render(mouseX, mouseY, lastFrameDuration);
|
||||
this.drawMouseoverTooltip(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,12 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.ClientChunkManager;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonSimple;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
|
@ -41,34 +44,29 @@ public class GuiChunkLoader extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
super.init();
|
||||
addButton(new GuiButtonUpDown(left + 64, top + 40, this, b -> onClick(5), UpDownButtonType.FASTFORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 12, top + 40, this, b -> onClick(1), UpDownButtonType.FORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 24, top + 40, this, b -> onClick(-1), UpDownButtonType.REWIND));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 36, top + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
|
||||
|
||||
addButton(new GuiButtonSimple(left + 10, top + 70, 155, 20, "Toggle Loaded Chunks", b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
|
||||
super.drawBackground(partialTicks, mouseX, mouseY);
|
||||
final Layer layer = Layer.BACKGROUND;
|
||||
|
||||
// Battery slot
|
||||
drawSlot(8, 72, layer);
|
||||
builder.drawUpDownButtons(this, 64, 40, layer);
|
||||
|
||||
if (GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE) {
|
||||
return;
|
||||
}
|
||||
String text = "Raidus: " + String.valueOf(blockEntity.getRadius());
|
||||
String text = "Radius: " + blockEntity.getRadius();
|
||||
drawCentredString(text, 25, 4210752, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawForeground(final int mouseX, final int mouseY) {
|
||||
super.drawForeground(mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
addButton(new GuiButtonUpDown(left + 64, top + 40, this, b -> onClick(5)));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 12, top + 40, this, b -> onClick(1)));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 24, top + 40, this, b -> onClick(-1)));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 36, top + 40, this, b -> onClick(-5)));
|
||||
}
|
||||
|
||||
public void onClick(int amount){
|
||||
NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity));
|
||||
NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity, ClientChunkManager.hasChunksForLoader(blockEntity.getPos())));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import reborncore.client.containerBuilder.builder.BuiltContainer;
|
|||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
|
@ -56,6 +57,15 @@ public class GuiFusionReactor extends GuiBase<BuiltContainer> {
|
|||
super(player, blockEntity, blockEntity.createContainer(syncID, player));
|
||||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
addButton(new GuiButtonUpDown(left + 121, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(5), UpDownButtonType.FASTFORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 12, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(1), UpDownButtonType.FORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 24, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-5), UpDownButtonType.REWIND));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 36, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-1), UpDownButtonType.FASTREWIND));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) {
|
||||
|
@ -101,15 +111,9 @@ public class GuiFusionReactor extends GuiBase<BuiltContainer> {
|
|||
|
||||
}
|
||||
}
|
||||
builder.drawUpDownButtons(this, 121, 79, layer);
|
||||
drawString("Size: " + blockEntity.size, 83, 81, 0xFFFFFF, layer);
|
||||
drawString("" + blockEntity.getPowerMultiplier() + "x", 10, 81, 0xFFFFFF, layer);
|
||||
|
||||
addButton(new GuiButtonUpDown(left + 121, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(5)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 12, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(1)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 24, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-5)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 36, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-1)));
|
||||
|
||||
builder.drawMultiEnergyBar(this, 9, 19, (int) this.blockEntity.getEnergy(), (int) this.blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,23 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonSimple;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
import techreborn.utils.PlayerUtils;
|
||||
|
||||
public class GuiIronFurnace extends GuiBase<BuiltContainer> {
|
||||
|
||||
|
@ -41,10 +51,59 @@ public class GuiIronFurnace extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = furnace;
|
||||
}
|
||||
|
||||
public void onClick(int amount){
|
||||
public void onClick(){
|
||||
NetworkManager.sendToServer(ServerboundPackets.createPacketExperience(blockEntity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
addButton(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, "", b -> onClick()) {
|
||||
|
||||
@Override
|
||||
public void renderToolTip(int mouseX, int mouseY) {
|
||||
PlayerEntity player = playerInventory.player;
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
String message = "Experience: ";
|
||||
|
||||
float furnaceExp = blockEntity.experience;
|
||||
if (furnaceExp <= 0) {
|
||||
message = message + "0";
|
||||
} else {
|
||||
float expTillLevel = (1.0F - player.experienceProgress) * player.getNextLevelExperience();
|
||||
if (furnaceExp <= expTillLevel) {
|
||||
int percentage = (int) (blockEntity.experience * 100 / player.getNextLevelExperience());
|
||||
message = message + "+"
|
||||
+ (percentage > 0 ? String.valueOf(percentage) : "<1")
|
||||
+ "%";
|
||||
} else {
|
||||
int levels = 0;
|
||||
furnaceExp -= expTillLevel;
|
||||
while (furnaceExp > 0) {
|
||||
furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
|
||||
++levels;
|
||||
}
|
||||
message = message + "+" + String.valueOf(levels) + "L";
|
||||
}
|
||||
}
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(message);
|
||||
renderTooltip(list, mouseX, mouseY);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBg(MinecraftClient mc, int mouseX, int mouseY) {
|
||||
mc.getItemRenderer().renderGuiItem(new ItemStack(Items.EXPERIENCE_BOTTLE), x, y);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
|
||||
super.drawBackground(lastFrameDuration, mouseX, mouseY);
|
||||
|
@ -59,17 +118,11 @@ public class GuiIronFurnace extends GuiBase<BuiltContainer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawForeground(final int mouseX, final int mouseY) {
|
||||
protected void drawForeground(int mouseX, int mouseY) {
|
||||
super.drawForeground(mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
builder.drawProgressBar(this, blockEntity.gaugeProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
|
||||
builder.drawBurnBar(this, blockEntity.gaugeFuelScaled(100), 100, 56, 36, mouseX, mouseY, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float lastFrameDuration) {
|
||||
super.render(mouseX, mouseY, lastFrameDuration);
|
||||
this.drawMouseoverTooltip(mouseX, mouseY);
|
||||
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
|
||||
builder.drawBurnBar(this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,10 +241,6 @@ public class TechRebornConfig {
|
|||
@Config(config = "items", category = "upgrades", key = "energy_storage", comment = "Energy storage behavior extra power")
|
||||
public static double energyStoragePower = 40_000;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Machines
|
||||
@Config(config = "machines", category = "grinder", key = "GrinderInput", comment = "Grinder Max Input (Value in EU)")
|
||||
public static int grinderMaxInput = 32;
|
||||
|
@ -317,15 +313,9 @@ public class TechRebornConfig {
|
|||
|
||||
@Config(config = "machines", category = "rolling_machine", key = "RollingMachineMaxEnergy", comment = "Rolling Machine Max Energy (Value in EU)")
|
||||
public static int rollingMachineMaxEnergy = 10000;
|
||||
|
||||
@Config(config = "machines", category = "chunk_loader", key = "ChunkLoaderMaxInput", comment = "Chunk Loader Max Input")
|
||||
public static int chunkLoaderMaxInput = 32;
|
||||
|
||||
@Config(config = "machines", category = "chunk_loader", key = "ChunkLoaderMaxEnergy", comment = "Chunk Loader Max Energy")
|
||||
public static int chunkLoaderMaxEnergy = 10_000;
|
||||
|
||||
@Config(config = "machines", category = "chunk_loader", key = "ChunkLoaderMaxRadius", comment = "Chunk Loader Max Radius")
|
||||
public static int chunkLoaderMaxRadius = 10;
|
||||
public static int chunkLoaderMaxRadius = 5;
|
||||
|
||||
@Config(config = "machines", category = "assembling_machine", key = "AssemblingMachineMaxInput", comment = "Assembling Machine Max Input (Value in EU)")
|
||||
public static int assemblingMachineMaxInput = 128;
|
||||
|
@ -465,7 +455,12 @@ public class TechRebornConfig {
|
|||
@Config(config = "machines", category = "solid_canning_machine", key = "solidCanningMachineMaxInput", comment = "Solid Canning Machine Max Energy (Value in EU)")
|
||||
public static int solidCanningMachineMaxEnergy = 1_000;
|
||||
|
||||
@Config(config = "machines", category = "iron_machine", key = "fuel_scale", comment = "Multiplier for vanilla furnace item burn time")
|
||||
public static double fuelScale = 1.25;
|
||||
|
||||
@Config(config = "machines", category = "iron_machine", key = "cooking_scale", comment = "Multiplier for vanilla furnace item cook time")
|
||||
public static double cookingScale = 1.25;
|
||||
|
||||
// Misc
|
||||
@Config(config = "misc", category = "general", key = "IC2TransformersStyle", comment = "Input from dots side, output from other sides, like in IC2.")
|
||||
public static boolean IC2TransformersStyle = true;
|
||||
|
|
|
@ -24,16 +24,12 @@
|
|||
|
||||
package techreborn.events;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.FenceBlock;
|
||||
import net.minecraft.block.FenceGateBlock;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.block.SlabBlock;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.Settings;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import reborncore.RebornRegistry;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blocks.misc.BlockComputerCube;
|
||||
|
@ -117,18 +113,9 @@ public class ModRegistry {
|
|||
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"), itemGroup);
|
||||
RebornRegistry.registerBlock(
|
||||
TRContent.RUBBER_PLANK_SLAB = InitUtils
|
||||
.setup(new SlabBlock(FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE)
|
||||
.strength(2.0F, 15.0F).sounds(BlockSoundGroup.WOOD).build()), "rubber_plank_slab"), itemGroup);
|
||||
RebornRegistry.registerBlock(
|
||||
TRContent.RUBBER_FENCE = InitUtils
|
||||
.setup(new FenceBlock(FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE)
|
||||
.strength(2.0F, 15.0F).sounds(BlockSoundGroup.WOOD).build()), "rubber_fence"), itemGroup);
|
||||
RebornRegistry.registerBlock(
|
||||
TRContent.RUBBER_FENCE_GATE = InitUtils
|
||||
.setup(new FenceGateBlock(FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE)
|
||||
.strength(2.0F, 15.0F).sounds(BlockSoundGroup.WOOD).build()), "rubber_fence_gate"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_SLAB = InitUtils.setup(new SlabBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_plank_slab"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE = InitUtils.setup(new FenceBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE_GATE = InitUtils.setup(new FenceGateBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence_gate"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_plank_stair"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_TRAPDOOR = InitUtils.setup(new RubberTrapdoorBlock(), "rubber_trapdoor"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_BUTTON = InitUtils.setup(new RubberButtonBlock(), "rubber_button"), itemGroup);
|
||||
|
@ -151,139 +138,85 @@ public class ModRegistry {
|
|||
// Gem armor & tools
|
||||
if (TechRebornConfig.enableGemArmorAndTools) {
|
||||
// Todo: repair with tags
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.BRONZE_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.BRONZE), "bronze_sword"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.BRONZE_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.BRONZE), "bronze_pickaxe"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.BRONZE_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.BRONZE), "bronze_spade"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.BRONZE_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.BRONZE), "bronze_axe"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.BRONZE_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.BRONZE), "bronze_hoe"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.BRONZE), "bronze_sword"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.BRONZE), "bronze_pickaxe"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.BRONZE), "bronze_spade"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.BRONZE), "bronze_axe"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.BRONZE), "bronze_hoe"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_HELMET = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.HEAD), "bronze_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_CHESTPLATE = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.CHEST), "bronze_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_LEGGINGS = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.LEGS), "bronze_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_BOOTS = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.FEET), "bronze_boots"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.HEAD), "bronze_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.CHEST), "bronze_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.LEGS), "bronze_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.BRONZE_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.FEET), "bronze_boots"));
|
||||
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.RUBY_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.RUBY), "ruby_sword"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.RUBY_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.RUBY), "ruby_pickaxe"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.RUBY_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.RUBY), "ruby_spade"));
|
||||
RebornRegistry
|
||||
.registerItem(TRContent.RUBY_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.RUBY), "ruby_axe"));
|
||||
RebornRegistry
|
||||
.registerItem(TRContent.RUBY_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.RUBY), "ruby_hoe"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.RUBY), "ruby_sword"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.RUBY), "ruby_pickaxe"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.RUBY), "ruby_spade"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.RUBY), "ruby_axe"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.RUBY), "ruby_hoe"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.RUBY_HELMET = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.HEAD), "ruby_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_CHESTPLATE = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.CHEST), "ruby_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_LEGGINGS = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.LEGS), "ruby_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_BOOTS = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.FEET), "ruby_boots"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.HEAD), "ruby_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.CHEST), "ruby_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.LEGS), "ruby_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.RUBY_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.FEET), "ruby_boots"));
|
||||
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.SAPPHIRE_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.SAPPHIRE), "sapphire_sword"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_PICKAXE = InitUtils
|
||||
.setup(new ItemTRPickaxe(TRToolTier.SAPPHIRE), "sapphire_pickaxe"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.SAPPHIRE_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.SAPPHIRE), "sapphire_spade"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.SAPPHIRE_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.SAPPHIRE), "sapphire_axe"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.SAPPHIRE_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.SAPPHIRE), "sapphire_hoe"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.SAPPHIRE), "sapphire_sword"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.SAPPHIRE), "sapphire_pickaxe"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.SAPPHIRE), "sapphire_spade"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.SAPPHIRE), "sapphire_axe"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.SAPPHIRE), "sapphire_hoe"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_HELMET = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.HEAD), "sapphire_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_CHESTPLATE = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.CHEST), "sapphire_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_LEGGINGS = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.LEGS), "sapphire_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_BOOTS = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.FEET), "sapphire_boots"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.HEAD), "sapphire_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.CHEST), "sapphire_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.LEGS), "sapphire_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.SAPPHIRE_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.FEET), "sapphire_boots"));
|
||||
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.PERIDOT_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.PERIDOT), "peridot_sword"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_PICKAXE = InitUtils
|
||||
.setup(new ItemTRPickaxe(TRToolTier.PERIDOT), "peridot_pickaxe"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.PERIDOT_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.PERIDOT), "peridot_spade"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.PERIDOT_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.PERIDOT), "peridot_axe"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.PERIDOT_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.PERIDOT), "peridot_hoe"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.PERIDOT), "peridot_sword"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.PERIDOT), "peridot_pickaxe"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.PERIDOT), "peridot_spade"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.PERIDOT), "peridot_axe"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.PERIDOT), "peridot_hoe"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_HELMET = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.HEAD), "peridot_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_CHESTPLATE = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.CHEST), "peridot_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.LEGS), "peridot_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils
|
||||
.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.FEET), "peridot_boots"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.HEAD), "peridot_helmet"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_CHESTPLATE = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.CHEST), "peridot_chestplate"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.LEGS), "peridot_leggings"));
|
||||
RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.FEET), "peridot_boots"));
|
||||
}
|
||||
|
||||
// Battery
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.RED_CELL_BATTERY = InitUtils.setup(new ItemRedCellBattery(), "red_cell_battery"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.LITHIUM_ION_BATTERY = InitUtils.setup(new ItemLithiumIonBattery(), "lithium_ion_battery"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.LITHIUM_ION_BATPACK = InitUtils.setup(new ItemLithiumIonBatpack(), "lithium_ion_batpack"));
|
||||
RebornRegistry
|
||||
.registerItem(TRContent.ENERGY_CRYSTAL = InitUtils.setup(new ItemEnergyCrystal(), "energy_crystal"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.LAPOTRON_CRYSTAL = InitUtils.setup(new ItemLapotronCrystal(), "lapotron_crystal"));
|
||||
RebornRegistry
|
||||
.registerItem(TRContent.LAPOTRONIC_ORB = InitUtils.setup(new ItemLapotronicOrb(), "lapotronic_orb"));
|
||||
RebornRegistry.registerItem(
|
||||
TRContent.LAPOTRONIC_ORBPACK = InitUtils.setup(new ItemLapotronicOrbpack(), "lapotronic_orbpack"));
|
||||
RebornRegistry.registerItem(TRContent.RED_CELL_BATTERY = InitUtils.setup(new ItemRedCellBattery(), "red_cell_battery"));
|
||||
RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATTERY = InitUtils.setup(new ItemLithiumIonBattery(), "lithium_ion_battery"));
|
||||
RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATPACK = InitUtils.setup(new ItemLithiumIonBatpack(), "lithium_ion_batpack"));
|
||||
RebornRegistry.registerItem(TRContent.ENERGY_CRYSTAL = InitUtils.setup(new ItemEnergyCrystal(), "energy_crystal"));
|
||||
RebornRegistry.registerItem(TRContent.LAPOTRON_CRYSTAL = InitUtils.setup(new ItemLapotronCrystal(), "lapotron_crystal"));
|
||||
RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORB = InitUtils.setup(new ItemLapotronicOrb(), "lapotronic_orb"));
|
||||
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.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_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.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.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.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.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"));
|
||||
|
||||
// Armor
|
||||
RebornRegistry
|
||||
.registerItem(TRContent.CLOAKING_DEVICE = InitUtils.setup(new ItemCloakingDevice(), "cloaking_device"));
|
||||
RebornRegistry.registerItem(TRContent.CLOAKING_DEVICE = InitUtils.setup(new ItemCloakingDevice(), "cloaking_device"));
|
||||
|
||||
// Other
|
||||
RebornRegistry.registerItem(TRContent.FREQUENCY_TRANSMITTER = InitUtils.setup(new ItemFrequencyTransmitter(),
|
||||
"frequency_transmitter"));
|
||||
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"));
|
||||
|
|
|
@ -332,7 +332,7 @@ public class TRContent {
|
|||
|
||||
public enum StorageBlocks implements ItemConvertible {
|
||||
ALUMINUM, BRASS, BRONZE, CHROME, COPPER, ELECTRUM, INVAR, IRIDIUM, IRIDIUM_REINFORCED_STONE,
|
||||
IRIDIUM_REINFORCED_TUNGSTENSTEEL, LEAD, NICKEL, OSMIUM, PERIDOT, PLATINUM, RED_GARNET, REFINED_IRON, RUBY,
|
||||
IRIDIUM_REINFORCED_TUNGSTENSTEEL, LEAD, NICKEL, PERIDOT, PLATINUM, RED_GARNET, REFINED_IRON, RUBY,
|
||||
SAPPHIRE, SILVER, STEEL, TIN, TITANIUM, TUNGSTEN, TUNGSTENSTEEL, YELLOW_GARNET, ZINC;
|
||||
|
||||
public final String name;
|
||||
|
@ -583,7 +583,7 @@ public class TRContent {
|
|||
}
|
||||
|
||||
public enum Nuggets implements ItemConvertible {
|
||||
ALUMINUM, BRASS, BRONZE, CHROME, COPPER, DIAMOND, ELECTRUM, HOT_TUNGSTENSTEEL, INVAR, IRIDIUM, LEAD, NICKEL,
|
||||
ALUMINUM, BRASS, BRONZE, CHROME, COPPER, DIAMOND, ELECTRUM, EMERALD, HOT_TUNGSTENSTEEL, INVAR, IRIDIUM, LEAD, NICKEL,
|
||||
PLATINUM, REFINED_IRON, SILVER, STEEL, TIN, TITANIUM, TUNGSTEN, TUNGSTENSTEEL, ZINC;
|
||||
|
||||
public final String name;
|
||||
|
|
|
@ -131,11 +131,12 @@ public class ServerboundPackets {
|
|||
registerPacketHandler(CHUNKLOADER, (extendedPacketBuffer, context) -> {
|
||||
BlockPos pos = extendedPacketBuffer.readBlockPos();
|
||||
int buttonID = extendedPacketBuffer.readInt();
|
||||
boolean sync = extendedPacketBuffer.readBoolean();
|
||||
|
||||
context.getTaskQueue().execute(() -> {
|
||||
BlockEntity blockEntity = context.getPlayer().world.getBlockEntity(pos);
|
||||
if (blockEntity instanceof ChunkLoaderBlockEntity) {
|
||||
((ChunkLoaderBlockEntity) blockEntity).handleGuiInputFromClient(buttonID);
|
||||
((ChunkLoaderBlockEntity) blockEntity).handleGuiInputFromClient(buttonID, sync ? context.getPlayer() : null);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -193,10 +194,11 @@ public class ServerboundPackets {
|
|||
});
|
||||
}
|
||||
|
||||
public static Packet<ServerPlayPacketListener> createPacketChunkloader(int buttonID, ChunkLoaderBlockEntity blockEntity) {
|
||||
public static Packet<ServerPlayPacketListener> createPacketChunkloader(int buttonID, ChunkLoaderBlockEntity blockEntity, boolean sync) {
|
||||
return NetworkManager.createServerBoundPacket(CHUNKLOADER, extendedPacketBuffer -> {
|
||||
extendedPacketBuffer.writeBlockPos(blockEntity.getPos());
|
||||
extendedPacketBuffer.writeInt(buttonID);
|
||||
extendedPacketBuffer.writeBoolean(sync);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,14 @@
|
|||
|
||||
package techreborn.utils;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Block.Settings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -60,4 +65,20 @@ public class InitUtils {
|
|||
itemList.add(uncharged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
public static Settings setupRubberBlockSettings(boolean noCollision, float hardness, float resistance) {
|
||||
|
||||
FabricBlockSettings settings = FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE);
|
||||
settings.strength(hardness, resistance);
|
||||
settings.sounds(BlockSoundGroup.WOOD);
|
||||
if (noCollision) {
|
||||
settings.noCollision();
|
||||
}
|
||||
|
||||
return settings.build();
|
||||
}
|
||||
|
||||
public static Settings setupRubberBlockSettings(float hardness, float resistance) {
|
||||
return setupRubberBlockSettings(false, hardness, resistance);
|
||||
}
|
||||
}
|
||||
|
|
41
src/main/java/techreborn/utils/PlayerUtils.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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.utils;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class PlayerUtils {
|
||||
|
||||
public static int getLevelExperience(int level) {
|
||||
if (level >= 30) {
|
||||
return 112 + (level - 30) * 9;
|
||||
}
|
||||
return level >= 15 ? 37 + (level - 15) * 5 : 7 + level * 2;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -46,7 +46,6 @@ public class StackWIPHandler {
|
|||
|
||||
public static void setup() {
|
||||
wipBlocks.add(TRContent.Machine.MAGIC_ENERGY_ABSORBER.block);
|
||||
wipBlocks.add(TRContent.Machine.CHUNK_LOADER.block);
|
||||
wipBlocks.add(TRContent.Machine.MAGIC_ENERGY_CONVERTER.block);
|
||||
|
||||
addHead("modmuss50");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"parent": "minecraft:block/door_bottom",
|
||||
"textures": {
|
||||
"bottom": "techreborn:block/rubber_planks",
|
||||
"top": "techreborn:block/rubber_planks"
|
||||
"bottom": "techreborn:block/rubber_door_bottom",
|
||||
"top": "techreborn:block/rubber_door_top"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"parent": "minecraft:block/door_bottom_rh",
|
||||
"textures": {
|
||||
"bottom": "techreborn:block/rubber_planks",
|
||||
"top": "techreborn:block/rubber_planks"
|
||||
"bottom": "techreborn:block/rubber_door_bottom",
|
||||
"top": "techreborn:block/rubber_door_top"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"parent": "minecraft:block/door_top",
|
||||
"textures": {
|
||||
"bottom": "techreborn:block/rubber_planks",
|
||||
"top": "techreborn:block/rubber_planks"
|
||||
"bottom": "techreborn:block/rubber_door_bottom",
|
||||
"top": "techreborn:block/rubber_door_top"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"parent": "minecraft:block/door_top_rh",
|
||||
"textures": {
|
||||
"bottom": "techreborn:block/rubber_planks",
|
||||
"top": "techreborn:block/rubber_planks"
|
||||
"bottom": "techreborn:block/rubber_door_bottom",
|
||||
"top": "techreborn:block/rubber_door_top"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/template_orientable_trapdoor_bottom",
|
||||
"textures": {
|
||||
"texture": "techreborn:block/rubber_planks"
|
||||
"texture": "techreborn:block/rubber_trapdoor"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/template_orientable_trapdoor_open",
|
||||
"textures": {
|
||||
"texture": "techreborn:block/rubber_planks"
|
||||
"texture": "techreborn:block/rubber_trapdoor"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/template_orientable_trapdoor_top",
|
||||
"textures": {
|
||||
"texture": "techreborn:block/rubber_planks"
|
||||
"texture": "techreborn:block/rubber_trapdoor"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/nugget/emerald_nugget"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 455 B |
After Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 645 B After Width: | Height: | Size: 446 B |
After Width: | Height: | Size: 418 B |
Before Width: | Height: | Size: 605 B After Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 760 B After Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 710 B After Width: | Height: | Size: 448 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 439 B |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 669 B After Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 443 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 685 B After Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 678 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 708 B |
Before Width: | Height: | Size: 910 B After Width: | Height: | Size: 429 B |
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 790 B After Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 443 B |
Before Width: | Height: | Size: 895 B After Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 903 B After Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 415 B |
Before Width: | Height: | Size: 483 B After Width: | Height: | Size: 413 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 438 B |
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 438 B |
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 423 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 360 B |
Before Width: | Height: | Size: 486 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 533 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 378 B |
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 333 B |
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 322 B |
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 483 B After Width: | Height: | Size: 338 B |
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 515 B After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 479 B After Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 360 B |
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 346 B |
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 360 B |
Before Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 449 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 486 B After Width: | Height: | Size: 358 B |