This commit is contained in:
modmuss50 2020-03-25 19:36:02 +00:00
parent 8679c9398f
commit 11290e89e7
28 changed files with 63 additions and 53 deletions

View file

@ -65,12 +65,12 @@ license {
group = 'TechReborn'
dependencies {
minecraft "com.mojang:minecraft:20w12a"
mappings "net.fabricmc:yarn:20w12a+build.3:v2"
modImplementation "net.fabricmc:fabric-loader:0.7.8+build.187"
minecraft "com.mojang:minecraft:20w13a"
mappings "net.fabricmc:yarn:20w13a+build.1:v2"
modImplementation "net.fabricmc:fabric-loader:0.7.8+build.189"
//Fabric api
modImplementation "net.fabricmc.fabric-api:fabric-api:0.5.5+build.311-1.16"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.5.6+build.313-1.16"
optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.1.1-unstable")
optionalDependency ('io.github.cottonmc:LibCD:2.3.0+1.15.2')

View file

@ -107,8 +107,8 @@ public class CableBlockEntity extends BlockEntity
@Override
public void fromTag(CompoundTag compound) {
super.fromTag(compound);
public void fromTag(BlockState blockState, CompoundTag compound) {
super.fromTag(blockState, compound);
if (compound.contains("energy")) {
energy = compound.getDouble("energy");
}

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.generator;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
@ -181,8 +182,8 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
}
@Override
public void fromTag(CompoundTag tagCompound) {
super.fromTag(tagCompound);
public void fromTag(BlockState blockState, CompoundTag tagCompound) {
super.fromTag(blockState, tagCompound);
tank.read(tagCompound);
}

View file

@ -25,6 +25,7 @@
package techreborn.blockentity.generator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
@ -228,13 +229,13 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
}
@Override
public void fromTag(CompoundTag tag) {
public void fromTag(BlockState blockState, CompoundTag tag) {
if (world == null) {
// We are in BlockEntity.create method during chunk load.
this.checkOverfill = false;
}
updatePanel();
super.fromTag(tag);
super.fromTag(blockState, tag);
}
// MachineBaseBlockEntity

View file

@ -127,8 +127,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
// MachineBaseBlockEntity
@Override
public void fromTag(CompoundTag compoundTag) {
super.fromTag(compoundTag);
public void fromTag(BlockState blockState, CompoundTag compoundTag) {
super.fromTag(blockState, compoundTag);
burnTime = compoundTag.getInt("BurnTime");
totalBurnTime = compoundTag.getInt("TotalBurnTime");
progress = compoundTag.getInt("Progress");

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.machine.iron;
import net.minecraft.block.BlockState;
import net.minecraft.entity.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@ -125,8 +126,8 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
}
@Override
public void fromTag(CompoundTag compoundTag) {
super.fromTag(compoundTag);
public void fromTag(BlockState blockState, CompoundTag compoundTag) {
super.fromTag(blockState, compoundTag);
experience = compoundTag.getFloat("Experience");
}

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.machine.misc;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@ -74,11 +75,11 @@ public class AlarmBlockEntity extends BlockEntity
}
@Override
public void fromTag(CompoundTag compound) {
public void fromTag(BlockState blockState, CompoundTag compound) {
if (compound != null && compound.contains("selectedSound")) {
selectedSound = compound.getInt("selectedSound");
}
super.fromTag(compound);
super.fromTag(blockState, compound);
}
// ITickable

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.machine.multiblock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos;
@ -99,8 +100,8 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
// TilePowerAcceptor
@Override
public void fromTag(final CompoundTag tagCompound) {
super.fromTag(tagCompound);
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
super.fromTag(blockState, tagCompound);
tank.read(tagCompound);
}

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.machine.multiblock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
@ -346,8 +347,8 @@ public class FusionControlComputerBlockEntity extends PowerAcceptorBlockEntity
}
@Override
public void fromTag(final CompoundTag tagCompound) {
super.fromTag(tagCompound);
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
super.fromTag(blockState, tagCompound);
this.crafingTickTime = tagCompound.getInt("crafingTickTime");
this.neededPower = tagCompound.getInt("neededPower");
this.hasStartedCrafting = tagCompound.getBoolean("hasStartedCrafting");

View file

@ -100,8 +100,8 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl
}
@Override
public void fromTag(final CompoundTag tagCompound) {
super.fromTag(tagCompound);
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
super.fromTag(blockState, tagCompound);
tank.read(tagCompound);
}

View file

@ -102,8 +102,8 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl
// TilePowerAcceptor
@Override
public void fromTag(final CompoundTag tagCompound) {
super.fromTag(tagCompound);
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
super.fromTag(blockState, tagCompound);
tank.read(tagCompound);
}

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.machine.tier1;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
@ -431,11 +432,11 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
}
@Override
public void fromTag(CompoundTag tag) {
public void fromTag(BlockState blockState, CompoundTag tag) {
if (tag.contains("locked")) {
locked = tag.getBoolean("locked");
}
super.fromTag(tag);
super.fromTag(blockState, tag);
}
// TileMachineBase

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.machine.tier1;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
@ -110,8 +111,8 @@ public class PlayerDectectorBlockEntity extends PowerAcceptorBlockEntity impleme
}
@Override
public void fromTag(CompoundTag tag) {
super.fromTag(tag);
public void fromTag(BlockState blockState, CompoundTag tag) {
super.fromTag(blockState, tag);
owenerUdid = tag.getString("ownerID");
}

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.machine.tier1;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
@ -348,8 +349,8 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
}
@Override
public void fromTag(final CompoundTag tagCompound) {
super.fromTag(tagCompound);
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
super.fromTag(blockState, tagCompound);
this.isRunning = tagCompound.getBoolean("isRunning");
this.tickTime = tagCompound.getInt("tickTime");
this.locked = tagCompound.getBoolean("locked");

View file

@ -140,8 +140,8 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
}
@Override
public void fromTag(CompoundTag nbttagcompound) {
super.fromTag(nbttagcompound);
public void fromTag(BlockState blockState, CompoundTag nbttagcompound) {
super.fromTag(blockState, nbttagcompound);
this.radius = nbttagcompound.getInt("radius");
this.ownerUdid = nbttagcompound.getString("ownerUdid");
if(!StringUtils.isBlank(ownerUdid)){

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.storage.energy;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
@ -143,8 +144,8 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
}
@Override
public void fromTag(CompoundTag nbttagcompound) {
super.fromTag(nbttagcompound);
public void fromTag(BlockState blockState, CompoundTag nbttagcompound) {
super.fromTag(blockState, nbttagcompound);
this.OUTPUT = nbttagcompound.getInt("output");
}

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.storage.energy.idsu;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import org.apache.commons.lang3.StringUtils;
@ -101,8 +102,8 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
}
@Override
public void fromTag(CompoundTag nbttagcompound) {
super.fromTag(nbttagcompound);
public void fromTag(BlockState blockState, CompoundTag nbttagcompound) {
super.fromTag(blockState, nbttagcompound);
this.ownerUdid = nbttagcompound.getString("ownerUdid");
}

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.storage.fluid;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@ -104,8 +105,8 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
}
@Override
public void fromTag(final CompoundTag tagCompound) {
super.fromTag(tagCompound);
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
super.fromTag(blockState, tagCompound);
if (tagCompound.contains("unitType")) {
this.type = TRContent.TankUnit.valueOf(tagCompound.getString("unitType"));
configureEntity(type);

View file

@ -261,8 +261,8 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity
}
@Override
public void fromTag(CompoundTag tagCompound) {
super.fromTag(tagCompound);
public void fromTag(BlockState blockState, CompoundTag tagCompound) {
super.fromTag(blockState, tagCompound);
if (tagCompound.contains("unitType")) {
this.type = TRContent.StorageUnit.valueOf(tagCompound.getString("unitType"));

View file

@ -27,7 +27,6 @@ package techreborn.blocks.cable;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityContext;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
@ -212,7 +211,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, EntityContext entityContext) {
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext shapeContext) {
if (state.get(COVERED)) {
return VoxelShapes.fullCube();
}

View file

@ -27,7 +27,6 @@ package techreborn.blocks.lighting;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.EntityContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
@ -85,7 +84,7 @@ public class BlockLamp extends BaseBlockEntityProvider {
}
@Override
public VoxelShape getOutlineShape(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityContext entityContext) {
public VoxelShape getOutlineShape(BlockState blockState, BlockView blockView, BlockPos blockPos, ShapeContext shapeContext) {
return shape[blockState.get(FACING).ordinal()];
}

View file

@ -28,9 +28,9 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.ShapeContext;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.EntityContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
@ -159,7 +159,7 @@ public class BlockAlarm extends BaseBlockEntityProvider {
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, EntityContext entityContext) {
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext shapeContext) {
return shape[getFacing(state).ordinal()];
}

View file

@ -71,7 +71,7 @@ public class BlockRubberLog extends PillarBlock {
public static BooleanProperty HAS_SAP = BooleanProperty.of("hassap");
public BlockRubberLog() {
super(Settings.method_26240(Material.WOOD, (blockState) -> MaterialColor.SPRUCE)
super(Settings.of(Material.WOOD, (blockState) -> MaterialColor.SPRUCE)
.strength(2.0F, 2f)
.sounds(BlockSoundGroup.WOOD)
.ticksRandomly());

View file

@ -76,7 +76,7 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
if (fluid != Fluids.EMPTY) {
FluidRenderHandler fluidRenderHandler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
BakedModel fluidModel = bakedModelManager.getModel(getFluidModel());
int fluidColor = fluidRenderHandler.getFluidColor(MinecraftClient.getInstance().world, MinecraftClient.getInstance().player.getSenseCenterPos(), fluid.getDefaultState());
int fluidColor = fluidRenderHandler.getFluidColor(MinecraftClient.getInstance().world, MinecraftClient.getInstance().player.getBlockPos(), fluid.getDefaultState());
Sprite fluidSprite = fluidRenderHandler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
int color = new Color((float) (fluidColor >> 16 & 255) / 255.0F, (float) (fluidColor >> 8 & 255) / 255.0F, (float) (fluidColor & 255) / 255.0F).getColor();
context.pushTransform(quad -> {

View file

@ -89,7 +89,7 @@ public class EntityNukePrimed extends TntEntity {
if (!TechRebornConfig.nukeEnabled) {
return;
}
RebornExplosion nukeExplosion = new RebornExplosion(getSenseCenterPos(), world, TechRebornConfig.nukeRadius);
RebornExplosion nukeExplosion = new RebornExplosion(getBlockPos(), world, TechRebornConfig.nukeRadius);
nukeExplosion.setLivingBase(getCausingEntity());
nukeExplosion.explode();
}

View file

@ -117,7 +117,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
boolean hasData = false;
if (stack.hasTag() && stack.getTag().contains("blockEntity_data")) {
CompoundTag blockEntityData = stack.getTag().getCompound("blockEntity_data");
blockEntity.fromTag(blockEntityData);
blockEntity.fromTag(blockEntity.getCachedState(), blockEntityData);
hasData = true;
components.add(new LiteralText("Block data contained").formatted(Formatting.DARK_GREEN));
}

View file

@ -51,7 +51,7 @@ public class ScrapBoxItem extends Item {
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(world);
int random = world.random.nextInt(scrapboxRecipeList.size());
ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0);
WorldUtils.dropItem(out, world, player.getSenseCenterPos());
WorldUtils.dropItem(out, world, player.getBlockPos());
stack.decrement(1);
}
return new TypedActionResult<>(ActionResult.SUCCESS, stack);

View file

@ -38,8 +38,8 @@ public class PaintingToolItem extends Item {
BlockState blockState = context.getWorld().getBlockState(context.getBlockPos());
if (player.isSneaking()) {
if (blockState.method_26216(context.getWorld(), context.getBlockPos())
&& blockState.getBlock().getDefaultState().method_26216(context.getWorld(), context.getBlockPos())) {
if (blockState.isOpaqueFullCube(context.getWorld(), context.getBlockPos())
&& blockState.getBlock().getDefaultState().isOpaqueFullCube(context.getWorld(), context.getBlockPos())) {
context.getStack().getOrCreateTag().put("cover", NbtHelper.fromBlockState(blockState));
return ActionResult.SUCCESS;
}