1.19-pre1

This commit is contained in:
modmuss50 2022-05-18 20:20:44 +01:00
parent 05d443c51d
commit 3cb62b0291
95 changed files with 451 additions and 403 deletions

View file

@ -49,9 +49,9 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.tag.FluidTags;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.TypedActionResult;
@ -124,7 +124,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
if (!blockState.isAir() && !canPlace && (!(blockState.getBlock() instanceof FluidFillable) || !((FluidFillable) blockState.getBlock()).canFillWithFluid(world, pos, blockState, fluid))) {
return hitResult != null && this.placeFluid(player, world, hitResult.getBlockPos().offset(hitResult.getSide()), null, filledCell);
} else {
if (world.getDimension().isUltrawarm() && fluid.isIn(FluidTags.WATER)) {
if (world.getDimension().ultrawarm() && fluid.isIn(FluidTags.WATER)) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
@ -167,7 +167,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
Fluid fluid = getFluid(itemStack);
if (fluid != Fluids.EMPTY) {
// TODO use translation keys for fluid and the cell https://fabric.asie.pl/wiki/tutorial:lang?s[]=translation might be useful
return new LiteralText(new TranslatableText("item.techreborn.cell.fluid").getString().replace("$fluid$", FluidUtils.getFluidName(fluid)));
return Text.literal(Text.translatable("item.techreborn.cell.fluid").getString().replace("$fluid$", FluidUtils.getFluidName(fluid)));
}
return super.getName(itemStack);
}

View file

@ -31,12 +31,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.nbt.NbtOps;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.*;
import net.minecraft.util.dynamic.GlobalPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.GlobalPos;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
@ -66,17 +66,17 @@ public class FrequencyTransmitterItem extends Item {
.ifPresent(tag -> stack.getOrCreateNbt().put("pos", tag));
if (context.getPlayer() instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID, new TranslatableText("techreborn.message.setTo")
.append(new LiteralText(" X:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(new LiteralText(" Y:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(new LiteralText(" Z:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getZ())).formatted(Formatting.GOLD))
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID, Text.translatable("techreborn.message.setTo")
.append(Text.literal(" X:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(Text.literal(" Y:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(Text.literal(" Z:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getZ())).formatted(Formatting.GOLD))
.append(" ")
.append(new TranslatableText("techreborn.message.in").formatted(Formatting.GRAY))
.append(Text.translatable("techreborn.message.in").formatted(Formatting.GRAY))
.append(" ")
.append(new LiteralText(getDimName(globalPos.getDimension()).toString()).formatted(Formatting.GOLD)));
.append(Text.literal(getDimName(globalPos.getDimension()).toString()).formatted(Formatting.GOLD)));
}
return ActionResult.SUCCESS;
@ -98,11 +98,11 @@ public class FrequencyTransmitterItem extends Item {
if (player instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID,
new TranslatableText("techreborn.message.coordsHaveBeen")
Text.translatable("techreborn.message.coordsHaveBeen")
.formatted(Formatting.GRAY)
.append(" ")
.append(
new TranslatableText("techreborn.message.cleared")
Text.translatable("techreborn.message.cleared")
.formatted(Formatting.GOLD)
)
);
@ -116,10 +116,10 @@ public class FrequencyTransmitterItem extends Item {
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
getPos(stack)
.ifPresent(globalPos -> {
tooltip.add(new LiteralText(Formatting.GRAY + "X: " + Formatting.GOLD + globalPos.getPos().getX()));
tooltip.add(new LiteralText(Formatting.GRAY + "Y: " + Formatting.GOLD + globalPos.getPos().getY()));
tooltip.add(new LiteralText(Formatting.GRAY + "Z: " + Formatting.GOLD + globalPos.getPos().getZ()));
tooltip.add(new LiteralText(Formatting.DARK_GRAY + getDimName(globalPos.getDimension()).toString()));
tooltip.add(Text.literal(Formatting.GRAY + "X: " + Formatting.GOLD + globalPos.getPos().getX()));
tooltip.add(Text.literal(Formatting.GRAY + "Y: " + Formatting.GOLD + globalPos.getPos().getY()));
tooltip.add(Text.literal(Formatting.GRAY + "Z: " + Formatting.GOLD + globalPos.getPos().getZ()));
tooltip.add(Text.literal(Formatting.DARK_GRAY + getDimName(globalPos.getDimension()).toString()));
});
}

View file

@ -31,7 +31,7 @@ import net.minecraft.command.BlockDataObject;
import net.minecraft.item.Item;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.state.property.Property;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
@ -63,15 +63,15 @@ public class DebugToolItem extends Item {
if (context.getWorld().isClient) {
return ActionResult.SUCCESS;
}
sendMessage(context, new LiteralText(getRegistryName(block)));
sendMessage(context, Text.literal(getRegistryName(block)));
for (Entry<Property<?>, Comparable<?>> entry : blockState.getEntries().entrySet()) {
sendMessage(context, new LiteralText(getPropertyString(entry)));
sendMessage(context, Text.literal(getPropertyString(entry)));
}
EnergyStorage energyStorage = EnergyStorage.SIDED.find(context.getWorld(), context.getBlockPos(), context.getSide());
if (energyStorage != null) {
sendMessage(context, new LiteralText(getRCPower(energyStorage)));
sendMessage(context, Text.literal(getRCPower(energyStorage)));
}
BlockEntity blockEntity = context.getWorld().getBlockEntity(context.getBlockPos());
@ -79,7 +79,7 @@ public class DebugToolItem extends Item {
return ActionResult.CONSUME;
}
sendMessage(context, new LiteralText(getBlockEntityType(blockEntity)));
sendMessage(context, Text.literal(getBlockEntityType(blockEntity)));
sendMessage(context, getBlockEntityTags(blockEntity));
@ -90,7 +90,7 @@ public class DebugToolItem extends Item {
if (context.getWorld().isClient || context.getPlayer() == null) {
return;
}
context.getPlayer().sendSystemMessage(message, Util.NIL_UUID);
context.getPlayer().sendMessage(message);
}
private String getPropertyString(Entry<Property<?>, Comparable<?>> entryIn) {
@ -136,7 +136,7 @@ public class DebugToolItem extends Item {
}
private Text getBlockEntityTags(BlockEntity blockEntity){
MutableText s = new LiteralText("BlockEntity Tags:").formatted(Formatting.GREEN);
MutableText s = Text.literal("BlockEntity Tags:").formatted(Formatting.GREEN);
BlockDataObject bdo = new BlockDataObject(blockEntity, blockEntity.getPos());
s.append(bdo.getNbt().toString());

View file

@ -35,7 +35,7 @@ import net.minecraft.nbt.NbtHelper;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
@ -97,10 +97,10 @@ public class PaintingToolItem extends Item {
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
BlockState blockState = getCover(stack);
if (blockState != null) {
tooltip.add((new TranslatableText(blockState.getBlock().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add((new TranslatableText("techreborn.tooltip.painting_tool.apply")).formatted(Formatting.GOLD));
tooltip.add((Text.translatable(blockState.getBlock().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add((Text.translatable("techreborn.tooltip.painting_tool.apply")).formatted(Formatting.GOLD));
} else {
tooltip.add((new TranslatableText("techreborn.tooltip.painting_tool.select")).formatted(Formatting.GOLD));
tooltip.add((Text.translatable("techreborn.tooltip.painting_tool.select")).formatted(Formatting.GOLD));
}
}

View file

@ -31,9 +31,9 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
@ -69,7 +69,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
ItemUtils.switchActive(stack, cost, messageId, entity);
stack.getOrCreateNbt().putBoolean("AOE5", false);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("3*3").formatted(Formatting.GOLD)));
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, Text.translatable("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(Text.literal("3*3").formatted(Formatting.GOLD)));
}
} else {
if (isAOE5(stack)) {
@ -78,7 +78,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
} else {
stack.getOrCreateNbt().putBoolean("AOE5", true);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("5*5").formatted(Formatting.GOLD)));
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, Text.translatable("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(Text.literal("5*5").formatted(Formatting.GOLD)));
}
}
}
@ -149,9 +149,9 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
ItemUtils.buildActiveTooltip(stack, tooltip);
if (ItemUtils.isActive(stack)) {
if (isAOE5(stack)) {
tooltip.add(new LiteralText("5*5").formatted(Formatting.RED));
tooltip.add(Text.literal("5*5").formatted(Formatting.RED));
} else {
tooltip.add(new LiteralText("3*3").formatted(Formatting.RED));
tooltip.add(Text.literal("3*3").formatted(Formatting.RED));
}
}
}