Update mappings + more tile work

This commit is contained in:
modmuss50 2019-02-22 10:29:11 +00:00
parent 63fe6d2ef4
commit b864d551dd
17 changed files with 80 additions and 76 deletions

View file

@ -72,10 +72,10 @@ public class ItemFrequencyTransmitter extends Item {
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
stack.setTag(new NBTTagCompound());
stack.getTag().setInt("x", pos.getX());
stack.getTag().setInt("y", pos.getY());
stack.getTag().setInt("z", pos.getZ());
stack.getTag().setInt("dim", world.provider.getDimension());
stack.getTag().putInt("x", pos.getX());
stack.getTag().putInt("y", pos.getY());
stack.getTag().putInt("z", pos.getZ());
stack.getTag().putInt("dim", world.provider.getDimension());
if (!world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
@ -111,7 +111,7 @@ public class ItemFrequencyTransmitter extends Item {
@OnlyIn(Dist.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (stack.hasTag() && stack.getTag() != null && stack.getTag().hasKey("x") && stack.getTag().hasKey("y") && stack.getTag().hasKey("z") && stack.getTag().hasKey("dim")) {
if (stack.hasTag() && stack.getTag() != null && stack.getTag().contains("x") && stack.getTag().contains("y") && stack.getTag().contains("z") && stack.getTag().contains("dim")) {
int x = stack.getTag().getInt("x");
int y = stack.getTag().getInt("y");
int z = stack.getTag().getInt("z");
@ -138,7 +138,7 @@ public class ItemFrequencyTransmitter extends Item {
TextFormatting gold = TextFormatting.GOLD;
TextFormatting grey = TextFormatting.GRAY;
if (stack.getItem() instanceof ItemFrequencyTransmitter) {
if (stack.hasTag() && stack.getTag() != null && stack.getTag().hasKey("x") && stack.getTag().hasKey("y") && stack.getTag().hasKey("z") && stack.getTag().hasKey("dim")) {
if (stack.hasTag() && stack.getTag() != null && stack.getTag().contains("x") && stack.getTag().contains("y") && stack.getTag().contains("z") && stack.getTag().contains("dim")) {
int coordX = stack.getTag().getInt("x");
int coordY = stack.getTag().getInt("y");
int coordZ = stack.getTag().getInt("z");

View file

@ -70,13 +70,13 @@ public class TileAlarm extends TileEntity
if (compound == null) {
compound = new NBTTagCompound();
}
compound.setInt("selectedSound", this.selectedSound);
compound.putInt("selectedSound", this.selectedSound);
return super.write(compound);
}
@Override
public void read(NBTTagCompound compound) {
if (compound != null && compound.hasKey("selectedSound")) {
if (compound != null && compound.contains("selectedSound")) {
selectedSound = compound.getInt("selectedSound");
}
super.read(compound);

View file

@ -25,6 +25,8 @@
package techreborn.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import reborncore.api.IListInfoProvider;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister;
@ -72,8 +74,8 @@ public class TileIndustrialCentrifuge extends TileGenericMachine implements ICon
// IListInfoProvider
@Override
public void addInfo(final List<String> info, final boolean isRealTile, boolean hasData) {
public void addInfo(final List<ITextComponent> info, final boolean isRealTile, boolean hasData) {
super.addInfo(info, isRealTile, hasData);
info.add("Round and round it goes");
info.add(new TextComponentString("Round and round it goes"));
}
}

View file

@ -30,6 +30,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop;
import reborncore.api.tile.ItemHandlerProvider;
@ -81,7 +83,7 @@ public class TileQuantumTank extends TileMachineBase
final ItemStack dropStack = TRContent.Machine.QUANTUM_TANK.getStack();
this.writeWithoutCoords(tileEntity);
dropStack.setTag(new NBTTagCompound());
dropStack.getTag().setTag("tileEntity", tileEntity);
dropStack.getTag().put("tileEntity", tileEntity);
return dropStack;
}
@ -135,15 +137,15 @@ public class TileQuantumTank extends TileMachineBase
// IListInfoProvider
@Override
public void addInfo(final List<String> info, final boolean isRealTile, boolean hasData) {
public void addInfo(final List<ITextComponent> info, final boolean isRealTile, boolean hasData) {
if (isRealTile | hasData) {
if (this.tank.getFluid() != null) {
info.add(this.tank.getFluidAmount() + " of " + this.tank.getFluidType().getName());
info.add(new TextComponentString(this.tank.getFluidAmount() + " of " + this.tank.getFluidType().getName()));
} else {
info.add("Empty");
info.add(new TextComponentString("Empty"));
}
}
info.add("Capacity " + this.tank.getCapacity() + " mb");
info.add(new TextComponentString("Capacity " + this.tank.getCapacity() + " mb"));
}
// IContainerProvider

View file

@ -31,6 +31,8 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.common.util.NonNullSupplier;
@ -65,7 +67,7 @@ public class TileTechStorageBase extends TileMachineBase
storedItem = ItemStack.EMPTY;
if (tagCompound.hasKey("storedStack")) {
if (tagCompound.contains("storedStack")) {
storedItem = ItemStack.read(tagCompound.getCompound("storedStack"));
}
@ -82,10 +84,10 @@ public class TileTechStorageBase extends TileMachineBase
if (storedItem.getCount() > storedItem.getMaxStackSize()) {
temp.setCount(storedItem.getMaxStackSize());
}
tagCompound.setTag("storedStack", temp.write(new NBTTagCompound()));
tagCompound.setInt("storedQuantity", Math.min(storedItem.getCount(), maxCapacity));
tagCompound.put("storedStack", temp.write(new NBTTagCompound()));
tagCompound.putInt("storedQuantity", Math.min(storedItem.getCount(), maxCapacity));
} else {
tagCompound.setInt("storedQuantity", 0);
tagCompound.putInt("storedQuantity", 0);
}
inventory.write(tagCompound);
return tagCompound;
@ -96,7 +98,7 @@ public class TileTechStorageBase extends TileMachineBase
ItemStack dropStack = new ItemStack(getBlockType(), 1);
writeWithoutCoords(tileEntity);
dropStack.setTag(new NBTTagCompound());
dropStack.getTag().setTag("tileEntity", tileEntity);
dropStack.getTag().put("tileEntity", tileEntity);
storedItem.setCount(0);
inventory.setStackInSlot(1, ItemStack.EMPTY);
syncWithAll();
@ -248,7 +250,7 @@ public class TileTechStorageBase extends TileMachineBase
// IListInfoProvider
@Override
public void addInfo(List<String> info, boolean isRealTile, boolean hasData) {
public void addInfo(List<ITextComponent> info, boolean isRealTile, boolean hasData) {
if (isRealTile || hasData) {
int size = 0;
String name = "of nothing";
@ -260,7 +262,7 @@ public class TileTechStorageBase extends TileMachineBase
name = inventory.getStackInSlot(1).getDisplayName().getString();
size += inventory.getStackInSlot(1).getCount();
}
info.add(size + " " + name);
info.add(new TextComponentString(size + " " + name));
}
}

View file

@ -34,8 +34,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import reborncore.api.IListInfoProvider;
@ -83,21 +86,12 @@ public class TileCable extends TileEntity
return canReceive();
}
// TileEntity
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
if (capability == CapabilityEnergy.ENERGY) {
return true;
}
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
public <T> LazyOptional<T> getCapability(Capability<T> capability) {
if (capability == CapabilityEnergy.ENERGY) {
return CapabilityEnergy.ENERGY.cast(this);
}
return super.getCapability(capability, facing);
return super.getCapability(capability);
}
@Override
@ -120,7 +114,7 @@ public class TileCable extends TileEntity
@Override
public void read(NBTTagCompound compound) {
super.read(compound);
if (compound.hasKey("TileCable")) {
if (compound.contains("TileCable")) {
power = compound.getCompound("TileCable").getInt("power");
}
}
@ -130,8 +124,8 @@ public class TileCable extends TileEntity
super.write(compound);
if (power > 0) {
NBTTagCompound data = new NBTTagCompound();
data.setInt("power", getEnergyStored());
compound.setTag("TileCable", data);
data.putInt("power", getEnergyStored());
compound.put("TileCable", data);
}
return compound;
}
@ -246,13 +240,13 @@ public class TileCable extends TileEntity
// IListInfoProvider
@Override
public void addInfo(List<String> info, boolean isRealTile, boolean hasData) {
public void addInfo(List<ITextComponent> info, boolean isRealTile, boolean hasData) {
if (isRealTile) {
info.add(TextFormatting.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": "
info.add(new TextComponentString(TextFormatting.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": "
+ TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(transferRate / RebornCoreConfig.euPerFU) + "/t");
info.add(TextFormatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": "
+ TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString()));
+ PowerSystem.getLocaliszedPowerFormatted(transferRate / RebornCoreConfig.euPerFU) + "/t"));
info.add(new TextComponentString(TextFormatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": "
+ TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString())));
}
}

View file

@ -320,14 +320,14 @@ public class TileFusionControlComputer extends TilePowerAcceptor
this.finalTickTime = tagCompound.getInt("finalTickTime");
this.neededPower = tagCompound.getInt("neededPower");
this.hasStartedCrafting = tagCompound.getBoolean("hasStartedCrafting");
if(tagCompound.hasKey("hasActiveRecipe") && tagCompound.getBoolean("hasActiveRecipe") && this.currentRecipe == null){
if(tagCompound.contains("hasActiveRecipe") && tagCompound.getBoolean("hasActiveRecipe") && this.currentRecipe == null){
for (final FusionReactorRecipe reactorRecipe : FusionReactorRecipeHelper.reactorRecipes) {
if (validateReactorRecipe(reactorRecipe)) {
this.currentRecipe = reactorRecipe;
}
}
}
if(tagCompound.hasKey("size")){
if(tagCompound.contains("size")){
this.size = tagCompound.getInt("size");
}
this.size = Math.min(size, maxCoilSize);//Done here to force the samller size, will be useful if people lag out on a large one.
@ -336,12 +336,12 @@ public class TileFusionControlComputer extends TilePowerAcceptor
@Override
public NBTTagCompound write(final NBTTagCompound tagCompound) {
super.write(tagCompound);
tagCompound.setInt("crafingTickTime", this.crafingTickTime);
tagCompound.setInt("finalTickTime", this.finalTickTime);
tagCompound.setInt("neededPower", this.neededPower);
tagCompound.setBoolean("hasStartedCrafting", this.hasStartedCrafting);
tagCompound.setBoolean("hasActiveRecipe", this.currentRecipe != null);
tagCompound.setInt("size", size);
tagCompound.putInt("crafingTickTime", this.crafingTickTime);
tagCompound.putInt("finalTickTime", this.finalTickTime);
tagCompound.putInt("neededPower", this.neededPower);
tagCompound.putBoolean("hasStartedCrafting", this.hasStartedCrafting);
tagCompound.putBoolean("hasActiveRecipe", this.currentRecipe != null);
tagCompound.putInt("size", size);
return tagCompound;
}

View file

@ -30,6 +30,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import reborncore.api.IToolDrop;
import reborncore.api.power.EnumPowerTier;
@ -129,18 +131,18 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
// TODO: Translate
@Override
public void addInfo(List<String> info, boolean isRealTile, boolean hasData) {
info.add(TextFormatting.GRAY + "Internal Energy Storage: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted((int) getMaxPower()));
public void addInfo(List<ITextComponent> info, boolean isRealTile, boolean hasData) {
info.add(new TextComponentString(TextFormatting.GRAY + "Internal Energy Storage: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted((int) getMaxPower())));
info.add(TextFormatting.GRAY + "Generation Rate Day: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD));
info.add(new TextComponentString(TextFormatting.GRAY + "Generation Rate Day: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD)));
info.add(TextFormatting.GRAY + "Generation Rate Night: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN));
info.add(new TextComponentString(TextFormatting.GRAY + "Generation Rate Night: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN)));
info.add(TextFormatting.GRAY + "Tier: " + TextFormatting.GOLD
+ StringUtils.toFirstCapitalAllLowercase(getTier().toString()));
info.add(new TextComponentString(TextFormatting.GRAY + "Tier: " + TextFormatting.GOLD
+ StringUtils.toFirstCapitalAllLowercase(getTier().toString())));
}
@Override

View file

@ -70,7 +70,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
}
public static int getItemBurnTime(ItemStack stack) {
return TileEntityFurnace.getItemBurnTime(stack) / 4;
return TileEntityFurnace.getBurnTimes().get(stack) / 4;
}
@Override

View file

@ -87,7 +87,7 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
// Bottom center shouldn't have any tile entities below it
if (world.getBlockState(new BlockPos(location.getX(), location.getY() - 1, location.getZ()))
.getBlock() == tileEntity.getBlockType()) {
.getBlock() == tileEntity.getWorld().getBlockState(tileEntity.getPos()).getBlock()) {
return 0;
}

View file

@ -380,13 +380,13 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
@Override
public NBTTagCompound write(NBTTagCompound tag) {
tag.setBoolean("locked", locked);
tag.putBoolean("locked", locked);
return super.write(tag);
}
@Override
public void read(NBTTagCompound tag) {
if (tag.hasKey("locked")) {
if (tag.contains("locked")) {
locked = tag.getBoolean("locked");
}
super.read(tag);

View file

@ -132,7 +132,7 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
@Override
public NBTTagCompound write(NBTTagCompound tag) {
super.write(tag);
tag.setString("ownerID", owenerUdid);
tag.putString("ownerID", owenerUdid);
return tag;
}

View file

@ -289,9 +289,9 @@ public class TileRollingMachine extends TilePowerAcceptor
@Override
public NBTTagCompound write(final NBTTagCompound tagCompound) {
super.write(tagCompound);
tagCompound.setBoolean("isRunning", this.isRunning);
tagCompound.setInt("tickTime", this.tickTime);
tagCompound.setBoolean("locked", locked);
tagCompound.putBoolean("isRunning", this.isRunning);
tagCompound.putInt("tickTime", this.tickTime);
tagCompound.putBoolean("locked", locked);
return tagCompound;
}

View file

@ -81,7 +81,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
ItemStack dropStack = TRContent.Machine.ADJUSTABLE_SU.getStack();
writeWithoutCoords(tileEntity);
dropStack.setTag(new NBTTagCompound());
dropStack.getTag().setTag("tileEntity", tileEntity);
dropStack.getTag().put("tileEntity", tileEntity);
return dropStack;
}
@ -108,7 +108,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
@Override
public NBTTagCompound write(NBTTagCompound tagCompound) {
super.write(tagCompound);
tagCompound.setInt("output", OUTPUT);
tagCompound.putInt("output", OUTPUT);
inventory.write(tagCompound);
return tagCompound;
}

View file

@ -43,7 +43,7 @@ public class IDSUSaveManger extends WorldSavedData implements IDataIDSU {
@Override
public NBTTagCompound write(NBTTagCompound compound) {
compound.setDouble("power", power);
compound.putDouble("power", power);
return compound;
}

View file

@ -105,7 +105,7 @@ public class TileInterdimensionalSU extends TileEnergyStorage implements IContai
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
return nbttagcompound;
}
nbttagcompound.setString("ownerUdid", this.ownerUdid);
nbttagcompound.putString("ownerUdid", this.ownerUdid);
return nbttagcompound;
}

View file

@ -29,6 +29,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop;
@ -141,11 +143,11 @@ public class TileTransformer extends TilePowerAcceptor
// IListInfoProvider
@Override
public void addInfo(List<String> info, boolean isRealTile, boolean hasData) {
info.add(TextFormatting.GRAY + "Input Rate: " + TextFormatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput()));
info.add(TextFormatting.GRAY + "Input Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString()));
info.add(TextFormatting.GRAY + "Output Rate: " + TextFormatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput()));
info.add(TextFormatting.GRAY + "Output Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString()));
public void addInfo(List<ITextComponent> info, boolean isRealTile, boolean hasData) {
info.add(new TextComponentString(TextFormatting.GRAY + "Input Rate: " + TextFormatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput())));
info.add(new TextComponentString(TextFormatting.GRAY + "Input Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString())));
info.add(new TextComponentString(TextFormatting.GRAY + "Output Rate: " + TextFormatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput())));
info.add(new TextComponentString(TextFormatting.GRAY + "Output Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString())));
}
}