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

This commit is contained in:
modmuss50 2019-09-12 16:55:52 +01:00
commit 6e53132c59
285 changed files with 667 additions and 615 deletions

View file

@ -48,7 +48,7 @@ repositories {
} }
} }
version = "3.0.11" version = "3.0.12"
configurations { configurations {
shade shade

View file

@ -24,16 +24,21 @@
package techreborn.api.recipe.recipes; package techreborn.api.recipe.recipes;
import com.google.common.collect.Iterables;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import net.minecraft.inventory.CraftingInventory; import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.RecipeSerializer; import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.ShapedRecipe; import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.tag.ItemTags;
import net.minecraft.tag.Tag;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -53,8 +58,9 @@ public class RollingMachineRecipe extends RebornRecipe {
@Override @Override
public void deserialize(JsonObject jsonObject) { public void deserialize(JsonObject jsonObject) {
shaped = JsonHelper.getObject(jsonObject, "shaped"); JsonObject json = JsonHelper.getObject(jsonObject, "shaped");
shapedRecipe = RecipeSerializer.SHAPED.read(getId(), shaped); shapedRecipe = RecipeSerializer.SHAPED.read(getId(), json);
shaped = withoutTags(json);
} }
@Override @Override
@ -62,6 +68,27 @@ public class RollingMachineRecipe extends RebornRecipe {
jsonObject.add("shaped", shaped); 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 @Override
public DefaultedList<RebornIngredient> getRebornIngredients() { public DefaultedList<RebornIngredient> getRebornIngredients() {
return DefaultedList.of(); return DefaultedList.of();

View file

@ -68,14 +68,14 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
checkTier(); checkTier();
} }
public int getProgressScaled(final int scale) { public int getProgressScaled(int scale) {
if (crafter != null && crafter.currentTickTime != 0) { if (crafter != null && crafter.currentTickTime != 0) {
return crafter.currentTickTime * scale / crafter.currentNeededTicks; return crafter.currentTickTime * scale / crafter.currentNeededTicks;
} }
return 0; return 0;
} }
// TilePowerAcceptor // PowerAcceptorBlockEntity
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
@ -115,7 +115,7 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
return new ItemStack(toolDrop, 1); return new ItemStack(toolDrop, 1);
} }
// ItemHandlerProvider // InventoryProvider
@Override @Override
public RebornInventory<?> getInventory() { public RebornInventory<?> getInventory() {
return inventory; return inventory;

View file

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

View file

@ -24,18 +24,11 @@
package techreborn.blockentity.machine.iron; 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.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; 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.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder; 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.RebornRecipe;
import reborncore.common.crafting.ingredient.RebornIngredient; import reborncore.common.crafting.ingredient.RebornIngredient;
import reborncore.common.util.RebornInventory; import reborncore.common.util.RebornInventory;
@ -43,77 +36,15 @@ import techreborn.init.ModRecipes;
import techreborn.init.TRBlockEntities; import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent; import techreborn.init.TRContent;
public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity implements IContainerProvider {
implements IToolDrop, InventoryProvider, 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 input1 = 0;
int input2 = 1; int input2 = 1;
int output = 2; int output = 2;
int fuel = 3;
public IronAlloyFurnaceBlockEntity() { public IronAlloyFurnaceBlockEntity() {
super(TRBlockEntities.IRON_ALLOY_FURNACE); super(TRBlockEntities.IRON_ALLOY_FURNACE, 3, TRContent.Machine.IRON_ALLOY_FURNACE.block);
} this.inventory = new RebornInventory<>(4, "IronAlloyFurnaceBlockEntity", 64, this);
/**
* 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();
}
} }
public boolean hasAllInputs(RebornRecipe recipeType) { public boolean hasAllInputs(RebornRecipe recipeType) {
@ -133,7 +64,8 @@ public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
return true; return true;
} }
private boolean canSmelt() { @Override
protected boolean canSmelt() {
if (inventory.getInvStack(input1).isEmpty() || inventory.getInvStack(input2).isEmpty()) { if (inventory.getInvStack(input1).isEmpty() || inventory.getInvStack(input2).isEmpty()) {
return false; return false;
} }
@ -155,11 +87,8 @@ public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
return result <= inventory.getStackLimit() && result <= inventory.getInvStack(output).getMaxCount(); return result <= inventory.getStackLimit() && result <= inventory.getInvStack(output).getMaxCount();
} }
/** @Override
* Turn one item from the furnace source stack into the appropriate smelted protected void smelt() {
* item in the furnace result stack
*/
public void smeltItem() {
if (!canSmelt()) { if (!canSmelt()) {
return; 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 @Override
public BuiltContainer createContainer(int syncID, final PlayerEntity player) { public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory().hotbar() return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory().hotbar()
.addInventory().blockEntity(this) .addInventory().blockEntity(this)
.slot(0, 47, 17) .slot(0, 47, 17)
.slot(1, 65, 17) .slot(1, 65, 17)
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53).syncIntegerValue(this::getBurnTime, this::setBurnTime) .outputSlot(2, 116, 35).fuelSlot(3, 56, 53)
.syncIntegerValue(this::getCookTime, this::setCookTime) .syncIntegerValue(this::getBurnTime, this::setBurnTime)
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create(this, syncID); .syncIntegerValue(this::getProgress, this::setProgress)
} .syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime)
.addInventory().create(this, syncID);
@Override
public boolean canBeUpgraded() {
return false;
} }
} }

View file

@ -26,8 +26,6 @@ package techreborn.blockentity.machine.iron;
import java.util.Optional; import java.util.Optional;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.entity.ExperienceOrbEntity; import net.minecraft.entity.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -35,105 +33,36 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.recipe.RecipeType; import net.minecraft.recipe.RecipeType;
import net.minecraft.recipe.SmeltingRecipe; import net.minecraft.recipe.SmeltingRecipe;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import reborncore.api.blockentity.InventoryProvider;
import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder; 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.RebornInventory;
import reborncore.common.util.ItemUtils;
import techreborn.init.TRBlockEntities; import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.utils.RecipeUtils; import techreborn.utils.RecipeUtils;
public class IronFurnaceBlockEntity extends MachineBaseBlockEntity public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity implements IContainerProvider {
implements InventoryProvider, 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 inputSlot = 0;
int outputSlot = 1; int outputSlot = 1;
int fuelSlot = 2; public float experience;
boolean active = false;
private float experience;
public IronFurnaceBlockEntity() { 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(){ public void handleGuiInputFromClient(PlayerEntity playerIn) {
return (slotID, stack, face, direction, blockEntity) -> { if (playerIn instanceof ServerPlayerEntity) {
if(direction == IInventoryAccess.AccessDirection.INSERT){ ServerPlayerEntity player = (ServerPlayerEntity) playerIn;
boolean isFuel = AbstractFurnaceBlockEntity.canUseAsFuel(stack); int totalExperience = (int) experience;
if(isFuel){ while (totalExperience > 0) {
ItemStack fuelSlotStack = blockEntity.inventory.getInvStack(blockEntity.fuelSlot); int expToDrop = ExperienceOrbEntity.roundToOrbSize(totalExperience);
if(fuelSlotStack.isEmpty() || ItemUtils.isItemEqual(stack, fuelSlotStack, true, true) && fuelSlotStack.getMaxCount() != fuelSlotStack.getCount()){ totalExperience -= expToDrop;
return slotID == blockEntity.fuelSlot; player.world.spawnEntity(new ExperienceOrbEntity(player.world, player.x, player.y + 0.5D, player.z + 0.5D, expToDrop));
}
}
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;
} }
} }
return burnTime * scale / totalBurnTime; experience = 0;
}
private void cookItems() {
if (!canSmelt()) {
return;
}
ItemStack inputStack = inventory.getInvStack(inputSlot);
ItemStack outputStack = getResultFor(inputStack);
float recipeExp = getExperienceFor(inputStack);
if (inventory.getInvStack(outputSlot).isEmpty()) {
inventory.setInvStack(outputSlot, outputStack.copy());
} else if (inventory.getInvStack(outputSlot).isItemEqualIgnoreDamage(outputStack)) {
inventory.getInvStack(outputSlot).increment(outputStack.getCount());
}
if (inputStack.getCount() > 1) {
inventory.shrinkSlot(inputSlot, 1);
} else {
inventory.setInvStack(inputSlot, ItemStack.EMPTY);
}
experience += recipeExp;
}
private boolean canSmelt() {
if (inventory.getInvStack(inputSlot).isEmpty()) {
return false;
}
ItemStack outputStack = getResultFor(inventory.getInvStack(inputSlot));
if (outputStack.isEmpty())
return false;
if (inventory.getInvStack(outputSlot).isEmpty())
return true;
if (!inventory.getInvStack(outputSlot).isItemEqualIgnoreDamage(outputStack))
return false;
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) { private ItemStack getResultFor(ItemStack stack) {
@ -152,29 +81,44 @@ public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
return 0; return 0;
} }
public void handleGuiInputFromClient(PlayerEntity playerIn) { // AbstractIronMachineBlockEntity
if (playerIn instanceof ServerPlayerEntity) { @Override
ServerPlayerEntity player = (ServerPlayerEntity) playerIn; protected void smelt() {
int totalExperience = (int) experience; if (!canSmelt()) {
while (totalExperience > 0) { return;
int expToDrop = ExperienceOrbEntity.roundToOrbSize(totalExperience); }
totalExperience -= expToDrop; ItemStack inputStack = inventory.getInvStack(inputSlot);
player.world.spawnEntity(new ExperienceOrbEntity(player.world, player.x, player.y + 0.5D, player.z + 0.5D, expToDrop)); ItemStack resultStack = getResultFor(inputStack);
}
experience = 0; if (inventory.getInvStack(outputSlot).isEmpty()) {
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);
} }
} }
private void updateState() { @Override
BlockState state = world.getBlockState(pos); protected boolean canSmelt() {
if (state.getBlock() instanceof BlockMachineBase) { if (inventory.getInvStack(inputSlot).isEmpty()) {
BlockMachineBase blockMachineBase = (BlockMachineBase) state.getBlock(); return false;
if (state.get(BlockMachineBase.ACTIVE) != burnTime > 0)
blockMachineBase.setActive(burnTime > 0, world, pos);
} }
ItemStack outputStack = getResultFor(inventory.getInvStack(inputSlot));
if (outputStack.isEmpty())
return false;
if (inventory.getInvStack(outputSlot).isEmpty())
return true;
if (!inventory.getInvStack(outputSlot).isItemEqualIgnoreDamage(outputStack))
return false;
int result = inventory.getInvStack(outputSlot).getCount() + outputStack.getCount();
return result <= inventory.getStackLimit() && result <= outputStack.getMaxCount();
} }
// MachineBaseBlockEntity
@Override @Override
public void fromTag(CompoundTag compoundTag) { public void fromTag(CompoundTag compoundTag) {
super.fromTag(compoundTag); super.fromTag(compoundTag);
@ -188,94 +132,24 @@ public class IronFurnaceBlockEntity extends MachineBaseBlockEntity
return compoundTag; 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();
}
}
@Override
public boolean canBeUpgraded() {
return false;
}
// InventoryProvider
@Override
public RebornInventory<IronFurnaceBlockEntity> getInventory() {
return this.inventory;
}
// IContainerProvider // IContainerProvider
public int getBurnTime() { public float getExperience() {
return this.burnTime; return experience;
} }
public void setBurnTime(int burnTime) { public void setExperience(float experience) {
this.burnTime = burnTime; this.experience = experience;
}
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;
} }
@Override @Override
public BuiltContainer createContainer(int syncID, final PlayerEntity player) { public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory().hotbar() 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::getBurnTime, this::setBurnTime)
.syncIntegerValue(this::getProgress, this::setProgress) .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);
} }
} }

View file

@ -24,32 +24,42 @@
package techreborn.blockentity.machine.tier3; package techreborn.blockentity.machine.tier3;
import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; 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.IToolDrop;
import reborncore.api.blockentity.InventoryProvider; import reborncore.api.blockentity.InventoryProvider;
import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder; import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.util.RebornInventory; import reborncore.common.util.RebornInventory;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRBlockEntities; import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent; 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 int radius;
private String ownerUdid;
public ChunkLoaderBlockEntity() { public ChunkLoaderBlockEntity() {
super(TRBlockEntities.CHUNK_LOADER ); super(TRBlockEntities.CHUNK_LOADER );
this.radius = 1; this.radius = 1;
} }
public void handleGuiInputFromClient(int buttonID) { public void handleGuiInputFromClient(int buttonID, @Nullable PlayerEntity playerEntity) {
radius += buttonID; radius += buttonID;
if (radius > TechRebornConfig.chunkLoaderMaxRadius) { if (radius > TechRebornConfig.chunkLoaderMaxRadius) {
@ -58,6 +68,13 @@ public class ChunkLoaderBlockEntity extends PowerAcceptorBlockEntity implements
if (radius <= 1) { if (radius <= 1) {
radius = 1; radius = 1;
} }
reload();
if(playerEntity != null){
ChunkLoaderManager manager = ChunkLoaderManager.get(getWorld());
manager.syncChunkLoaderToClient((ServerPlayerEntity) playerEntity, getPos());
}
} }
@Override @Override
@ -65,10 +82,52 @@ public class ChunkLoaderBlockEntity extends PowerAcceptorBlockEntity implements
return TRContent.Machine.CHUNK_LOADER.getStack(); 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 @Override
public void tick() { public void onBreak(World world, PlayerEntity playerEntity, BlockPos blockPos, BlockState blockState) {
super.tick(); if(world.isClient){
// TODO: chunkload 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 @Override
@ -83,34 +142,13 @@ public class ChunkLoaderBlockEntity extends PowerAcceptorBlockEntity implements
public void fromTag(CompoundTag nbttagcompound) { public void fromTag(CompoundTag nbttagcompound) {
super.fromTag(nbttagcompound); super.fromTag(nbttagcompound);
this.radius = nbttagcompound.getInt("radius"); this.radius = nbttagcompound.getInt("radius");
this.ownerUdid = nbttagcompound.getString("ownerUdid");
if(!StringUtils.isBlank(ownerUdid)){
nbttagcompound.putString("ownerUdid", this.ownerUdid);
}
inventory.read(nbttagcompound); 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 @Override
public RebornInventory<ChunkLoaderBlockEntity> getInventory() { public RebornInventory<ChunkLoaderBlockEntity> getInventory() {
return this.inventory; return this.inventory;
@ -127,6 +165,7 @@ public class ChunkLoaderBlockEntity extends PowerAcceptorBlockEntity implements
@Override @Override
public BuiltContainer createContainer(int syncID, PlayerEntity player) { public BuiltContainer createContainer(int syncID, PlayerEntity player) {
return new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory() 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);
} }
} }

View file

@ -66,6 +66,9 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
if (world.isClient) {
return;
}
if (!inventory.getInvStack(0).isEmpty()) { if (!inventory.getInvStack(0).isEmpty()) {
ItemStack stack = inventory.getInvStack(0); ItemStack stack = inventory.getInvStack(0);

View file

@ -108,7 +108,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
@Override @Override
public CompoundTag toTag(CompoundTag nbttagcompound) { public CompoundTag toTag(CompoundTag nbttagcompound) {
super.toTag(nbttagcompound); super.toTag(nbttagcompound);
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) { if (ownerUdid == null || StringUtils.isEmpty(ownerUdid)) {
return nbttagcompound; return nbttagcompound;
} }
nbttagcompound.putString("ownerUdid", this.ownerUdid); nbttagcompound.putString("ownerUdid", this.ownerUdid);

View file

@ -24,10 +24,8 @@
package techreborn.blocks.misc; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material;
import net.minecraft.block.WoodButtonBlock; import net.minecraft.block.WoodButtonBlock;
import net.minecraft.sound.BlockSoundGroup; import techreborn.utils.InitUtils;
/** /**
* @author drcrazy * @author drcrazy
@ -36,6 +34,6 @@ import net.minecraft.sound.BlockSoundGroup;
public class RubberButtonBlock extends WoodButtonBlock { public class RubberButtonBlock extends WoodButtonBlock {
public RubberButtonBlock() { 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));
} }
} }

View file

@ -24,11 +24,8 @@
package techreborn.blocks.misc; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.DoorBlock; import net.minecraft.block.DoorBlock;
import net.minecraft.block.Material; import techreborn.utils.InitUtils;
import net.minecraft.block.MaterialColor;
import net.minecraft.sound.BlockSoundGroup;
/** /**
* @author drcrazy * @author drcrazy
@ -37,6 +34,6 @@ import net.minecraft.sound.BlockSoundGroup;
public class RubberDoorBlock extends DoorBlock { public class RubberDoorBlock extends DoorBlock {
public RubberDoorBlock() { 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));
} }
} }

View file

@ -24,11 +24,8 @@
package techreborn.blocks.misc; 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.block.PressurePlateBlock;
import net.minecraft.sound.BlockSoundGroup; import techreborn.utils.InitUtils;
/** /**
* @author drcrazy * @author drcrazy
@ -37,7 +34,7 @@ import net.minecraft.sound.BlockSoundGroup;
public class RubberPressurePlateBlock extends PressurePlateBlock { public class RubberPressurePlateBlock extends PressurePlateBlock {
public RubberPressurePlateBlock() { 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));
} }
} }

View file

@ -24,11 +24,8 @@
package techreborn.blocks.misc; 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.block.TrapdoorBlock;
import net.minecraft.sound.BlockSoundGroup; import techreborn.utils.InitUtils;
/** /**
* @author drcrazy * @author drcrazy
@ -37,7 +34,6 @@ import net.minecraft.sound.BlockSoundGroup;
public class RubberTrapdoorBlock extends TrapdoorBlock { public class RubberTrapdoorBlock extends TrapdoorBlock {
public RubberTrapdoorBlock() { public RubberTrapdoorBlock() {
super(FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE).strength(3f, 3f).sounds(BlockSoundGroup.WOOD).build()); super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F));
} }
} }

View file

@ -30,6 +30,7 @@ import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -44,6 +45,15 @@ public class GuiAESU extends GuiBase<BuiltContainer> {
this.blockEntity = aesu; 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 @Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) { protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY); super.drawBackground(f, mouseX, mouseY);
@ -53,7 +63,6 @@ public class GuiAESU extends GuiBase<BuiltContainer> {
this.drawSlot(98, 45, layer); this.drawSlot(98, 45, layer);
this.drawArmourSlots(8, 18, layer); this.drawArmourSlots(8, 18, layer);
this.builder.drawEnergyOutput(this, 155, 61, this.blockEntity.getCurrentOutput(), layer); this.builder.drawEnergyOutput(this, 155, 61, this.blockEntity.getCurrentOutput(), layer);
this.builder.drawUpDownButtons(this, 121, 79, layer);
} }
@Override @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); 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){ public void onClick(int amount){

View file

@ -42,7 +42,6 @@ public class GuiAlloyFurnace extends GuiBase<BuiltContainer> {
@Override @Override
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) { protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(lastFrameDuration, mouseX, mouseY); super.drawBackground(lastFrameDuration, mouseX, mouseY);
GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
// Input slots // Input slots
@ -59,13 +58,7 @@ public class GuiAlloyFurnace extends GuiBase<BuiltContainer> {
super.drawForeground(mouseX, mouseY); super.drawForeground(mouseX, mouseY);
GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; 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); 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);
}
} }

View file

@ -25,9 +25,12 @@
package techreborn.client.gui; package techreborn.client.gui;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.ClientChunkManager;
import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.gui.builder.GuiBase; 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;
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity; import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -41,34 +44,29 @@ public class GuiChunkLoader extends GuiBase<BuiltContainer> {
this.blockEntity = blockEntity; 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 @Override
protected void drawBackground(float partialTicks, int mouseX, int mouseY) { protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY); super.drawBackground(partialTicks, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND; final Layer layer = Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
builder.drawUpDownButtons(this, 64, 40, layer);
if (GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE) { if (GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE) {
return; return;
} }
String text = "Raidus: " + String.valueOf(blockEntity.getRadius()); String text = "Radius: " + blockEntity.getRadius();
drawCentredString(text, 25, 4210752, layer); 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){ public void onClick(int amount){
NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity)); NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity, ClientChunkManager.hasChunksForLoader(blockEntity.getPos())));
} }
} }

View file

@ -34,6 +34,7 @@ import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended; import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -57,6 +58,15 @@ public class GuiFusionReactor extends GuiBase<BuiltContainer> {
this.blockEntity = blockEntity; 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 @Override
protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) { protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY); super.drawBackground(partialTicks, mouseX, 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("Size: " + blockEntity.size, 83, 81, 0xFFFFFF, layer);
drawString("" + blockEntity.getPowerMultiplier() + "x", 10, 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); builder.drawMultiEnergyBar(this, 9, 19, (int) this.blockEntity.getEnergy(), (int) this.blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
} }

View file

@ -24,13 +24,23 @@
package techreborn.client.gui; 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.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonSimple;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity; import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
import techreborn.utils.PlayerUtils;
public class GuiIronFurnace extends GuiBase<BuiltContainer> { public class GuiIronFurnace extends GuiBase<BuiltContainer> {
@ -41,10 +51,59 @@ public class GuiIronFurnace extends GuiBase<BuiltContainer> {
this.blockEntity = furnace; this.blockEntity = furnace;
} }
public void onClick(int amount){ public void onClick(){
NetworkManager.sendToServer(ServerboundPackets.createPacketExperience(blockEntity)); 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 @Override
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) { protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(lastFrameDuration, mouseX, mouseY); super.drawBackground(lastFrameDuration, mouseX, mouseY);
@ -59,17 +118,11 @@ public class GuiIronFurnace extends GuiBase<BuiltContainer> {
} }
@Override @Override
protected void drawForeground(final int mouseX, final int mouseY) { protected void drawForeground(int mouseX, int mouseY) {
super.drawForeground(mouseX, mouseY); super.drawForeground(mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.gaugeProgressScaled(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.gaugeFuelScaled(100), 100, 56, 36, mouseX, mouseY, 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);
} }
} }

View file

@ -241,10 +241,6 @@ public class TechRebornConfig {
@Config(config = "items", category = "upgrades", key = "energy_storage", comment = "Energy storage behavior extra power") @Config(config = "items", category = "upgrades", key = "energy_storage", comment = "Energy storage behavior extra power")
public static double energyStoragePower = 40_000; public static double energyStoragePower = 40_000;
// Machines // Machines
@Config(config = "machines", category = "grinder", key = "GrinderInput", comment = "Grinder Max Input (Value in EU)") @Config(config = "machines", category = "grinder", key = "GrinderInput", comment = "Grinder Max Input (Value in EU)")
public static int grinderMaxInput = 32; public static int grinderMaxInput = 32;
@ -318,14 +314,8 @@ public class TechRebornConfig {
@Config(config = "machines", category = "rolling_machine", key = "RollingMachineMaxEnergy", comment = "Rolling Machine Max Energy (Value in EU)") @Config(config = "machines", category = "rolling_machine", key = "RollingMachineMaxEnergy", comment = "Rolling Machine Max Energy (Value in EU)")
public static int rollingMachineMaxEnergy = 10000; 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") @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)") @Config(config = "machines", category = "assembling_machine", key = "AssemblingMachineMaxInput", comment = "Assembling Machine Max Input (Value in EU)")
public static int assemblingMachineMaxInput = 128; public static int assemblingMachineMaxInput = 128;
@ -465,6 +455,11 @@ public class TechRebornConfig {
@Config(config = "machines", category = "solid_canning_machine", key = "solidCanningMachineMaxInput", comment = "Solid Canning Machine Max Energy (Value in EU)") @Config(config = "machines", category = "solid_canning_machine", key = "solidCanningMachineMaxInput", comment = "Solid Canning Machine Max Energy (Value in EU)")
public static int solidCanningMachineMaxEnergy = 1_000; 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 // Misc
@Config(config = "misc", category = "general", key = "IC2TransformersStyle", comment = "Input from dots side, output from other sides, like in IC2.") @Config(config = "misc", category = "general", key = "IC2TransformersStyle", comment = "Input from dots side, output from other sides, like in IC2.")

View file

@ -24,16 +24,12 @@
package techreborn.events; package techreborn.events;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.FenceBlock; import net.minecraft.block.FenceBlock;
import net.minecraft.block.FenceGateBlock; import net.minecraft.block.FenceGateBlock;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.SlabBlock; import net.minecraft.block.SlabBlock;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings; import net.minecraft.item.Item.Settings;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.RebornRegistry; import reborncore.RebornRegistry;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.blocks.misc.BlockComputerCube; 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_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), 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_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"), itemGroup);
RebornRegistry.registerBlock( RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_SLAB = InitUtils.setup(new SlabBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_plank_slab"), itemGroup);
TRContent.RUBBER_PLANK_SLAB = InitUtils RebornRegistry.registerBlock(TRContent.RUBBER_FENCE = InitUtils.setup(new FenceBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence"), itemGroup);
.setup(new SlabBlock(FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE) RebornRegistry.registerBlock(TRContent.RUBBER_FENCE_GATE = InitUtils.setup(new FenceGateBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence_gate"), itemGroup);
.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_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_plank_stair"), 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_TRAPDOOR = InitUtils.setup(new RubberTrapdoorBlock(), "rubber_trapdoor"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_BUTTON = InitUtils.setup(new RubberButtonBlock(), "rubber_button"), itemGroup); RebornRegistry.registerBlock(TRContent.RUBBER_BUTTON = InitUtils.setup(new RubberButtonBlock(), "rubber_button"), itemGroup);
@ -151,139 +138,85 @@ public class ModRegistry {
// Gem armor & tools // Gem armor & tools
if (TechRebornConfig.enableGemArmorAndTools) { if (TechRebornConfig.enableGemArmorAndTools) {
// Todo: repair with tags // Todo: repair with tags
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.BRONZE_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.BRONZE), "bronze_sword"));
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( RebornRegistry.registerItem(TRContent.BRONZE_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.BRONZE), "bronze_spade"));
TRContent.BRONZE_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.BRONZE), "bronze_pickaxe")); RebornRegistry.registerItem(TRContent.BRONZE_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.BRONZE), "bronze_axe"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.BRONZE_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.BRONZE), "bronze_hoe"));
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 RebornRegistry.registerItem(TRContent.BRONZE_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.HEAD), "bronze_helmet"));
.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_CHESTPLATE = InitUtils RebornRegistry.registerItem(TRContent.BRONZE_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.LEGS), "bronze_leggings"));
.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.CHEST), "bronze_chestplate")); RebornRegistry.registerItem(TRContent.BRONZE_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.BRONZE, EquipmentSlot.FEET), "bronze_boots"));
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( RebornRegistry.registerItem(TRContent.RUBY_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.RUBY), "ruby_sword"));
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( RebornRegistry.registerItem(TRContent.RUBY_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.RUBY), "ruby_spade"));
TRContent.RUBY_PICKAXE = InitUtils.setup(new ItemTRPickaxe(TRToolTier.RUBY), "ruby_pickaxe")); RebornRegistry.registerItem(TRContent.RUBY_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.RUBY), "ruby_axe"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.RUBY_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.RUBY), "ruby_hoe"));
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 RebornRegistry.registerItem(TRContent.RUBY_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.HEAD), "ruby_helmet"));
.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_CHESTPLATE = InitUtils RebornRegistry.registerItem(TRContent.RUBY_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.LEGS), "ruby_leggings"));
.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.CHEST), "ruby_chestplate")); RebornRegistry.registerItem(TRContent.RUBY_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.RUBY, EquipmentSlot.FEET), "ruby_boots"));
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( RebornRegistry.registerItem(TRContent.SAPPHIRE_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.SAPPHIRE), "sapphire_sword"));
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_PICKAXE = InitUtils RebornRegistry.registerItem(TRContent.SAPPHIRE_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.SAPPHIRE), "sapphire_spade"));
.setup(new ItemTRPickaxe(TRToolTier.SAPPHIRE), "sapphire_pickaxe")); RebornRegistry.registerItem(TRContent.SAPPHIRE_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.SAPPHIRE), "sapphire_axe"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.SAPPHIRE_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.SAPPHIRE), "sapphire_hoe"));
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 RebornRegistry.registerItem(TRContent.SAPPHIRE_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.HEAD), "sapphire_helmet"));
.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_CHESTPLATE = InitUtils RebornRegistry.registerItem(TRContent.SAPPHIRE_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.LEGS), "sapphire_leggings"));
.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.CHEST), "sapphire_chestplate")); RebornRegistry.registerItem(TRContent.SAPPHIRE_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.SAPPHIRE, EquipmentSlot.FEET), "sapphire_boots"));
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( RebornRegistry.registerItem(TRContent.PERIDOT_SWORD = InitUtils.setup(new ItemTRSword(TRToolTier.PERIDOT), "peridot_sword"));
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_PICKAXE = InitUtils RebornRegistry.registerItem(TRContent.PERIDOT_SPADE = InitUtils.setup(new ItemTRSpade(TRToolTier.PERIDOT), "peridot_spade"));
.setup(new ItemTRPickaxe(TRToolTier.PERIDOT), "peridot_pickaxe")); RebornRegistry.registerItem(TRContent.PERIDOT_AXE = InitUtils.setup(new ItemTRAxe(TRToolTier.PERIDOT), "peridot_axe"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.PERIDOT_HOE = InitUtils.setup(new ItemTRHoe(TRToolTier.PERIDOT), "peridot_hoe"));
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 RebornRegistry.registerItem(TRContent.PERIDOT_HELMET = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.HEAD), "peridot_helmet"));
.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_CHESTPLATE = InitUtils RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.LEGS), "peridot_leggings"));
.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.CHEST), "peridot_chestplate")); RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils.setup(new ItemTRArmour(TRArmorMaterial.PERIDOT, EquipmentSlot.FEET), "peridot_boots"));
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 // Battery
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.RED_CELL_BATTERY = InitUtils.setup(new ItemRedCellBattery(), "red_cell_battery"));
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( RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATPACK = InitUtils.setup(new ItemLithiumIonBatpack(), "lithium_ion_batpack"));
TRContent.LITHIUM_ION_BATTERY = InitUtils.setup(new ItemLithiumIonBattery(), "lithium_ion_battery")); RebornRegistry.registerItem(TRContent.ENERGY_CRYSTAL = InitUtils.setup(new ItemEnergyCrystal(), "energy_crystal"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.LAPOTRON_CRYSTAL = InitUtils.setup(new ItemLapotronCrystal(), "lapotron_crystal"));
TRContent.LITHIUM_ION_BATPACK = InitUtils.setup(new ItemLithiumIonBatpack(), "lithium_ion_batpack")); RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORB = InitUtils.setup(new ItemLapotronicOrb(), "lapotronic_orb"));
RebornRegistry RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORBPACK = InitUtils.setup(new ItemLapotronicOrbpack(), "lapotronic_orbpack"));
.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 // Tools
RebornRegistry.registerItem(TRContent.TREE_TAP = InitUtils.setup(new ItemTreeTap(), "treetap")); RebornRegistry.registerItem(TRContent.TREE_TAP = InitUtils.setup(new ItemTreeTap(), "treetap"));
RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new ItemWrench(), "wrench")); RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new ItemWrench(), "wrench"));
RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new ItemBasicDrill(), "basic_drill")); RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new ItemBasicDrill(), "basic_drill"));
RebornRegistry RebornRegistry.registerItem(TRContent.BASIC_CHAINSAW = InitUtils.setup(new ItemBasicChainsaw(), "basic_chainsaw"));
.registerItem(TRContent.BASIC_CHAINSAW = InitUtils.setup(new ItemBasicChainsaw(), "basic_chainsaw")); RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new ItemBasicJackhammer(), "basic_jackhammer"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.ELECTRIC_TREE_TAP = InitUtils.setup(new ItemElectricTreetap(), "electric_treetap"));
TRContent.BASIC_JACKHAMMER = InitUtils.setup(new ItemBasicJackhammer(), "basic_jackhammer"));
RebornRegistry.registerItem(
TRContent.ELECTRIC_TREE_TAP = InitUtils.setup(new ItemElectricTreetap(), "electric_treetap"));
RebornRegistry RebornRegistry.registerItem(TRContent.ADVANCED_DRILL = InitUtils.setup(new ItemAdvancedDrill(), "advanced_drill"));
.registerItem(TRContent.ADVANCED_DRILL = InitUtils.setup(new ItemAdvancedDrill(), "advanced_drill")); RebornRegistry.registerItem(TRContent.ADVANCED_CHAINSAW = InitUtils.setup(new ItemAdvancedChainsaw(), "advanced_chainsaw"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.ADVANCED_JACKHAMMER = InitUtils.setup(new ItemAdvancedJackhammer(), "advanced_jackhammer"));
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.ROCK_CUTTER = InitUtils.setup(new ItemRockCutter(), "rock_cutter"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.INDUSTRIAL_DRILL = InitUtils.setup(new ItemIndustrialDrill(), "industrial_drill"));
TRContent.INDUSTRIAL_DRILL = InitUtils.setup(new ItemIndustrialDrill(), "industrial_drill")); RebornRegistry.registerItem(TRContent.INDUSTRIAL_CHAINSAW = InitUtils.setup(new ItemIndustrialChainsaw(), "industrial_chainsaw"));
RebornRegistry.registerItem( RebornRegistry.registerItem(TRContent.INDUSTRIAL_JACKHAMMER = InitUtils.setup(new ItemIndustrialJackhammer(), "industrial_jackhammer"));
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.NANOSABER = InitUtils.setup(new ItemNanosaber(), "nanosaber"));
RebornRegistry.registerItem(TRContent.OMNI_TOOL = InitUtils.setup(new ItemOmniTool(), "omni_tool")); RebornRegistry.registerItem(TRContent.OMNI_TOOL = InitUtils.setup(new ItemOmniTool(), "omni_tool"));
// Armor // Armor
RebornRegistry RebornRegistry.registerItem(TRContent.CLOAKING_DEVICE = InitUtils.setup(new ItemCloakingDevice(), "cloaking_device"));
.registerItem(TRContent.CLOAKING_DEVICE = InitUtils.setup(new ItemCloakingDevice(), "cloaking_device"));
// Other // Other
RebornRegistry.registerItem(TRContent.FREQUENCY_TRANSMITTER = InitUtils.setup(new ItemFrequencyTransmitter(), RebornRegistry.registerItem(TRContent.FREQUENCY_TRANSMITTER = InitUtils.setup(new ItemFrequencyTransmitter(), "frequency_transmitter"));
"frequency_transmitter"));
RebornRegistry.registerItem(TRContent.SCRAP_BOX = InitUtils.setup(new ItemScrapBox(), "scrap_box")); RebornRegistry.registerItem(TRContent.SCRAP_BOX = InitUtils.setup(new ItemScrapBox(), "scrap_box"));
RebornRegistry.registerItem(TRContent.MANUAL = InitUtils.setup(new ItemManual(), "manual")); 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 ItemDebugTool(), "debug_tool"));

View file

@ -332,7 +332,7 @@ public class TRContent {
public enum StorageBlocks implements ItemConvertible { public enum StorageBlocks implements ItemConvertible {
ALUMINUM, BRASS, BRONZE, CHROME, COPPER, ELECTRUM, INVAR, IRIDIUM, IRIDIUM_REINFORCED_STONE, 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; SAPPHIRE, SILVER, STEEL, TIN, TITANIUM, TUNGSTEN, TUNGSTENSTEEL, YELLOW_GARNET, ZINC;
public final String name; public final String name;
@ -583,7 +583,7 @@ public class TRContent {
} }
public enum Nuggets implements ItemConvertible { 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; PLATINUM, REFINED_IRON, SILVER, STEEL, TIN, TITANIUM, TUNGSTEN, TUNGSTENSTEEL, ZINC;
public final String name; public final String name;

View file

@ -131,11 +131,12 @@ public class ServerboundPackets {
registerPacketHandler(CHUNKLOADER, (extendedPacketBuffer, context) -> { registerPacketHandler(CHUNKLOADER, (extendedPacketBuffer, context) -> {
BlockPos pos = extendedPacketBuffer.readBlockPos(); BlockPos pos = extendedPacketBuffer.readBlockPos();
int buttonID = extendedPacketBuffer.readInt(); int buttonID = extendedPacketBuffer.readInt();
boolean sync = extendedPacketBuffer.readBoolean();
context.getTaskQueue().execute(() -> { context.getTaskQueue().execute(() -> {
BlockEntity blockEntity = context.getPlayer().world.getBlockEntity(pos); BlockEntity blockEntity = context.getPlayer().world.getBlockEntity(pos);
if (blockEntity instanceof ChunkLoaderBlockEntity) { 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 -> { return NetworkManager.createServerBoundPacket(CHUNKLOADER, extendedPacketBuffer -> {
extendedPacketBuffer.writeBlockPos(blockEntity.getPos()); extendedPacketBuffer.writeBlockPos(blockEntity.getPos());
extendedPacketBuffer.writeInt(buttonID); extendedPacketBuffer.writeInt(buttonID);
extendedPacketBuffer.writeBoolean(sync);
}); });
} }

View file

@ -24,9 +24,14 @@
package techreborn.utils; package techreborn.utils;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block; 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.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -60,4 +65,20 @@ public class InitUtils {
itemList.add(uncharged); itemList.add(uncharged);
itemList.add(charged); 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);
}
} }

View 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;
}
}

View file

@ -46,7 +46,6 @@ public class StackWIPHandler {
public static void setup() { public static void setup() {
wipBlocks.add(TRContent.Machine.MAGIC_ENERGY_ABSORBER.block); wipBlocks.add(TRContent.Machine.MAGIC_ENERGY_ABSORBER.block);
wipBlocks.add(TRContent.Machine.CHUNK_LOADER.block);
wipBlocks.add(TRContent.Machine.MAGIC_ENERGY_CONVERTER.block); wipBlocks.add(TRContent.Machine.MAGIC_ENERGY_CONVERTER.block);
addHead("modmuss50"); addHead("modmuss50");

View file

@ -1,7 +1,7 @@
{ {
"parent": "minecraft:block/door_bottom", "parent": "minecraft:block/door_bottom",
"textures": { "textures": {
"bottom": "techreborn:block/rubber_planks", "bottom": "techreborn:block/rubber_door_bottom",
"top": "techreborn:block/rubber_planks" "top": "techreborn:block/rubber_door_top"
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"parent": "minecraft:block/door_bottom_rh", "parent": "minecraft:block/door_bottom_rh",
"textures": { "textures": {
"bottom": "techreborn:block/rubber_planks", "bottom": "techreborn:block/rubber_door_bottom",
"top": "techreborn:block/rubber_planks" "top": "techreborn:block/rubber_door_top"
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"parent": "minecraft:block/door_top", "parent": "minecraft:block/door_top",
"textures": { "textures": {
"bottom": "techreborn:block/rubber_planks", "bottom": "techreborn:block/rubber_door_bottom",
"top": "techreborn:block/rubber_planks" "top": "techreborn:block/rubber_door_top"
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"parent": "minecraft:block/door_top_rh", "parent": "minecraft:block/door_top_rh",
"textures": { "textures": {
"bottom": "techreborn:block/rubber_planks", "bottom": "techreborn:block/rubber_door_bottom",
"top": "techreborn:block/rubber_planks" "top": "techreborn:block/rubber_door_top"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_orientable_trapdoor_bottom", "parent": "minecraft:block/template_orientable_trapdoor_bottom",
"textures": { "textures": {
"texture": "techreborn:block/rubber_planks" "texture": "techreborn:block/rubber_trapdoor"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_orientable_trapdoor_open", "parent": "minecraft:block/template_orientable_trapdoor_open",
"textures": { "textures": {
"texture": "techreborn:block/rubber_planks" "texture": "techreborn:block/rubber_trapdoor"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_orientable_trapdoor_top", "parent": "minecraft:block/template_orientable_trapdoor_top",
"textures": { "textures": {
"texture": "techreborn:block/rubber_planks" "texture": "techreborn:block/rubber_trapdoor"
} }
} }

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "techreborn:item/nugget/emerald_nugget"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 B

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 678 B

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 B

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 718 B

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 895 B

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 B

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 B

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 358 B

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