Start on new block settings.

This commit is contained in:
modmuss50 2023-05-10 23:03:58 +01:00 committed by modmuss
parent 503ed7ee49
commit 133f64ac9f
9 changed files with 53 additions and 29 deletions

View file

@ -31,7 +31,6 @@ import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.InventoryProvider;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
@ -68,10 +67,6 @@ public abstract class BlockMachineBase extends BaseBlockEntityProvider implement
boolean hasCustomStates;
public BlockMachineBase() {
this(Block.Settings.of(Material.METAL).strength(2F, 2F));
}
public BlockMachineBase(Block.Settings builder) {
this(builder, false);
}

View file

@ -47,7 +47,7 @@ public class ServerBoundPackets {
server.execute(() -> {
FluidConfiguration.FluidConfig fluidConfiguration = new FluidConfiguration.FluidConfig(compoundTag);
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.world.getBlockEntity(pos);
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.getWorld().getBlockEntity(pos);
legacyMachineBase.fluidConfiguration.updateFluidConfig(fluidConfiguration);
legacyMachineBase.markDirty();
@ -67,7 +67,7 @@ public class ServerBoundPackets {
NbtCompound tagCompound = packetBuffer.readNbt();
server.execute(() -> {
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.world.getBlockEntity(pos);
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.getWorld().getBlockEntity(pos);
legacyMachineBase.getSlotConfiguration().read(tagCompound);
legacyMachineBase.markDirty();
@ -82,7 +82,7 @@ public class ServerBoundPackets {
boolean output = packetBuffer.readBoolean();
server.execute(() -> {
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.world.getBlockEntity(pos);
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.getWorld().getBlockEntity(pos);
FluidConfiguration config = legacyMachineBase.fluidConfiguration;
if (config == null) {
return;
@ -104,7 +104,7 @@ public class ServerBoundPackets {
boolean filter = packetBuffer.readBoolean();
server.execute(() -> {
MachineBaseBlockEntity machineBase = (MachineBaseBlockEntity) player.world.getBlockEntity(pos);
MachineBaseBlockEntity machineBase = (MachineBaseBlockEntity) player.getWorld().getBlockEntity(pos);
Validate.notNull(machineBase, "machine cannot be null");
SlotConfiguration.SlotConfigHolder holder = machineBase.getSlotConfiguration().getSlotDetails(slotID);
if (holder == null) {
@ -127,7 +127,7 @@ public class ServerBoundPackets {
server.execute(() -> {
SlotConfiguration.SlotConfig slotConfig = new SlotConfiguration.SlotConfig(compoundTag);
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.world.getBlockEntity(pos);
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.getWorld().getBlockEntity(pos);
legacyMachineBase.getSlotConfiguration().getSlotDetails(slotConfig.getSlotID()).updateSlotConfig(slotConfig);
legacyMachineBase.markDirty();
@ -140,7 +140,7 @@ public class ServerBoundPackets {
BlockPos pos = packetBuffer.readBlockPos();
server.execute(() -> {
Validate.isInstanceOf(ServerPlayerEntity.class, player, "something very very bad has happened");
ChunkLoaderManager chunkLoaderManager = ChunkLoaderManager.get(player.world);
ChunkLoaderManager chunkLoaderManager = ChunkLoaderManager.get(player.getWorld());
chunkLoaderManager.syncChunkLoaderToClient((ServerPlayerEntity) player, pos);
});
});
@ -157,7 +157,7 @@ public class ServerBoundPackets {
RedstoneConfiguration.State state = RedstoneConfiguration.State.values()[stateId];
server.execute(() -> {
MachineBaseBlockEntity blockEntity = (MachineBaseBlockEntity) player.world.getBlockEntity(pos);
MachineBaseBlockEntity blockEntity = (MachineBaseBlockEntity) player.getWorld().getBlockEntity(pos);
if (blockEntity == null) return;
blockEntity.getRedstoneConfiguration().setState(element, state);

View file

@ -25,7 +25,7 @@
package reborncore.common.recipes;
import com.google.gson.JsonObject;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.class_8566;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.RecipeSerializer;
@ -66,7 +66,7 @@ public class PaddedShapedRecipe extends ShapedRecipe {
}
@Override
public boolean matches(CraftingInventory craftingInventory, World world) {
public boolean matches(class_8566 craftingInventory, World world) {
for(int i = 0; i <= craftingInventory.getWidth() - this.getWidth(); ++i) {
for(int j = 0; j <= craftingInventory.getHeight() - this.getHeight(); ++j) {
if (this.matchesPattern(craftingInventory, i, j, false)) {

View file

@ -46,6 +46,7 @@ import team.reborn.energy.api.EnergyStorageUtil;
import team.reborn.energy.api.base.SimpleBatteryItem;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
/**
@ -61,7 +62,7 @@ public class ItemUtils {
if (a.getItem() != b.getItem()) {
return false;
}
return !matchNBT || ItemStack.areNbtEqual(a, b);
return !matchNBT || Objects.equals(a.getNbt(), b.getNbt());
}
public static boolean isItemEqual(ItemStack a, ItemStack b, boolean matchNBT,

View file

@ -47,9 +47,9 @@ public abstract class MixinItemEntity extends Entity {
@Inject(method = "tick", at = @At("RETURN"))
public void tick(CallbackInfo info) {
if (!world.isClient && isTouchingWater() && !getStack().isEmpty()) {
if (!getWorld().isClient && isTouchingWater() && !getStack().isEmpty()) {
if (getStack().isIn(RebornCoreTags.WATER_EXPLOSION_ITEM)) {
world.createExplosion(this, getX(), getY(), getZ(), 2F, World.ExplosionSourceType.NONE);
getWorld().createExplosion(this, getX(), getY(), getZ(), 2F, World.ExplosionSourceType.NONE);
this.remove(RemovalReason.KILLED);
}
}