Destroyed and deprecated

- Fix rotation indicator particles
- Fix sail dyeing
- Turn BreakProgressHook into DestroyProgressRenderingHandler interface
- Refactor overlay rendering to properly use API
- Change SpriteShiftEntry to use StitchedSprites
- Use OnDatapackSyncEvent instead of mixin
- Organize foundation.ponder package
- Remove usage of deprecated:
-   Durability bar methods
-   Constants class
This commit is contained in:
PepperBell 2021-11-27 14:49:43 -08:00
parent 7a4ed99fb5
commit 1fdf1ff7e9
201 changed files with 849 additions and 919 deletions

View file

@ -166,7 +166,7 @@ jar {
'Specification-Vendor': 'simibubi',
'Specification-Version': '1',
'Implementation-Title': project.name,
'Implementation-Version': '${version}',
'Implementation-Version': "${version}",
'Implementation-Vendor': 'simibubi',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'MixinConfigs': 'create.mixins.json'

View file

@ -6,7 +6,7 @@ org.gradle.daemon = false
# mod version info
mod_version = 0.4
minecraft_version = 1.17.1
forge_version = 37.0.110
forge_version = 37.0.126
# build dependency versions
forgegradle_version = 5.1.+

View file

@ -326,8 +326,6 @@ public class AllSoundEvents {
wrappedEvents = new ArrayList<>();
variants = new ArrayList<>();
this.id = id;
variants.add(id);
}
public SoundEntryBuilder subtitle(String subtitle) {
@ -365,7 +363,7 @@ public class AllSoundEvents {
public SoundEntry build() {
SoundEntry entry = wrappedEvents.isEmpty() ? new CustomSoundEntry(id, variants, subtitle, category)
: new WrappedSoundEntry(id, variants, subtitle, wrappedEvents, category);
: new WrappedSoundEntry(id, subtitle, wrappedEvents, category);
entries.put(entry.getId(), entry);
return entry;
}
@ -375,13 +373,11 @@ public class AllSoundEvents {
public static abstract class SoundEntry {
protected ResourceLocation id;
protected List<ResourceLocation> variants;
protected String subtitle;
protected SoundSource category;
public SoundEntry(ResourceLocation id, List<ResourceLocation> variants, String subtitle, SoundSource category) {
public SoundEntry(ResourceLocation id, String subtitle, SoundSource category) {
this.id = id;
this.variants = variants;
this.subtitle = subtitle;
this.category = category;
}
@ -402,10 +398,6 @@ public class AllSoundEvents {
return id;
}
public List<ResourceLocation> getVariants() {
return variants;
}
public boolean hasSubtitle() {
return subtitle != null;
}
@ -462,9 +454,9 @@ public class AllSoundEvents {
private List<Pair<SoundEvent, Couple<Float>>> wrappedEvents;
private List<Pair<SoundEvent, Couple<Float>>> compiledEvents;
public WrappedSoundEntry(ResourceLocation id, List<ResourceLocation> variants, String subtitle, List<Pair<SoundEvent, Couple<Float>>> wrappedEvents,
public WrappedSoundEntry(ResourceLocation id, String subtitle, List<Pair<SoundEvent, Couple<Float>>> wrappedEvents,
SoundSource category) {
super(id, variants, subtitle, category);
super(id, subtitle, category);
this.wrappedEvents = wrappedEvents;
compiledEvents = Lists.newArrayList();
}
@ -535,10 +527,12 @@ public class AllSoundEvents {
private static class CustomSoundEntry extends SoundEntry {
protected List<ResourceLocation> variants;
protected SoundEvent event;
public CustomSoundEntry(ResourceLocation id, List<ResourceLocation> variants, String subtitle, SoundSource category) {
super(id, variants, subtitle, category);
super(id, subtitle, category);
this.variants = variants;
}
@Override
@ -561,6 +555,7 @@ public class AllSoundEvents {
JsonObject entry = new JsonObject();
JsonArray list = new JsonArray();
list.add(id.toString());
for (ResourceLocation variant : variants) {
list.add(variant.toString());
}

View file

@ -2,13 +2,10 @@ package com.simibubi.create;
import com.jozufozu.flywheel.core.StitchedSprite;
import net.minecraft.resources.ResourceLocation;
public class AllStitchedTextures {
public static final StitchedSprite SUPER_GLUE = new StitchedSprite(new ResourceLocation(Create.ID, "entity/super_glue/slime"));
public static final StitchedSprite SUPER_GLUE = new StitchedSprite(Create.asResource("entity/super_glue/slime"));
public static void init() {
}
}

View file

@ -3,10 +3,15 @@ package com.simibubi.create;
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.content.contraptions.components.structureMovement.render.SBBContraptionManager;
import com.simibubi.create.content.contraptions.goggles.GoggleOverlayRenderer;
import com.simibubi.create.content.contraptions.relays.encased.CasingConnectivity;
import com.simibubi.create.content.curiosities.armor.CopperBacktankArmorLayer;
import com.simibubi.create.content.curiosities.bell.SoulPulseEffectHandler;
import com.simibubi.create.content.curiosities.toolbox.ToolboxHandlerClient;
import com.simibubi.create.content.curiosities.tools.BlueprintOverlayRenderer;
import com.simibubi.create.content.curiosities.weapons.PotatoCannonRenderHandler;
import com.simibubi.create.content.curiosities.zapper.ZapperRenderHandler;
import com.simibubi.create.content.logistics.item.LinkedControllerClientHandler;
import com.simibubi.create.content.schematics.ClientSchematicLoader;
import com.simibubi.create.content.schematics.client.SchematicAndQuillHandler;
import com.simibubi.create.content.schematics.client.SchematicHandler;
@ -14,7 +19,7 @@ import com.simibubi.create.foundation.ClientResourceReloadListener;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.ponder.content.PonderIndex;
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
import com.simibubi.create.foundation.ponder.element.WorldSectionElement;
import com.simibubi.create.foundation.render.AllMaterialSpecs;
import com.simibubi.create.foundation.render.CachedBufferer;
import com.simibubi.create.foundation.render.CreateContexts;
@ -32,6 +37,8 @@ import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.OverlayRegistry;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
@ -82,9 +89,21 @@ public class CreateClient {
PonderIndex.register();
PonderIndex.registerTags();
registerOverlays();
UIRenderHelper.init();
}
private static void registerOverlays() {
// Register overlays in reverse order
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.AIR_LEVEL_ELEMENT, "Create's Remaining Air", CopperBacktankArmorLayer.REMAINING_AIR_OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Toolboxes", ToolboxHandlerClient.OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Goggle Information", GoggleOverlayRenderer.OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Blueprints", BlueprintOverlayRenderer.OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Linked Controller", LinkedControllerClientHandler.OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Schematics", SCHEMATIC_HANDLER.getOverlayRenderer());
}
public static void invalidateRenderers() {
BUFFER_CACHE.invalidate();

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.base;
import com.jozufozu.flywheel.backend.instancing.Instancer;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;

View file

@ -4,8 +4,6 @@ import com.jozufozu.flywheel.backend.material.Material;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;

View file

@ -24,10 +24,10 @@ import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
@ -219,7 +219,7 @@ public class ConnectedInputHandler {
public void read(CompoundTag nbt) {
isController = nbt.getBoolean("Controller");
data.clear();
nbt.getList("Data", NBT.TAG_COMPOUND)
nbt.getList("Data", Tag.TAG_COMPOUND)
.forEach(inbt -> data.add(NbtUtils.readBlockPos((CompoundTag) inbt)));
// nbt got wiped -> reset

View file

@ -4,7 +4,6 @@ import java.util.function.Supplier;
import com.jozufozu.flywheel.backend.instancing.Instancer;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;

View file

@ -24,6 +24,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.CraftingRecipe;
@ -31,7 +32,6 @@ import net.minecraft.world.item.crafting.FireworkRocketRecipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.util.Constants.NBT;
public class RecipeGridHandler {
@ -204,7 +204,7 @@ public class RecipeGridHandler {
public static GroupedItems read(CompoundTag nbt) {
GroupedItems items = new GroupedItems();
ListTag gridNBT = nbt.getList("Grid", NBT.TAG_COMPOUND);
ListTag gridNBT = nbt.getList("Grid", Tag.TAG_COMPOUND);
gridNBT.forEach(inbt -> {
CompoundTag entry = (CompoundTag) inbt;
int x = entry.getInt("x");

View file

@ -34,6 +34,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Inventory;
@ -43,7 +44,6 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.items.IItemHandler;
@ -237,7 +237,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
private DeployerFakePlayer getPlayer(MovementContext context) {
if (!(context.temporaryData instanceof DeployerFakePlayer) && context.world instanceof ServerLevel) {
DeployerFakePlayer deployerFakePlayer = new DeployerFakePlayer((ServerLevel) context.world);
deployerFakePlayer.getInventory().load(context.tileData.getList("Inventory", NBT.TAG_COMPOUND));
deployerFakePlayer.getInventory().load(context.tileData.getList("Inventory", Tag.TAG_COMPOUND));
if (context.data.contains("HeldItem"))
deployerFakePlayer.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.of(context.data.getCompound("HeldItem")));
context.tileData.remove("Inventory");

View file

@ -9,12 +9,12 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.Tag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraftforge.common.util.Constants;
public class DeployerMovingInteraction extends MovingInteractionBehaviour {
@ -56,7 +56,7 @@ public class DeployerMovingInteraction extends MovingInteractionBehaviour {
if (!(ctx.temporaryData instanceof DeployerFakePlayer) && ctx.world instanceof ServerLevel) {
DeployerFakePlayer deployerFakePlayer = new DeployerFakePlayer((ServerLevel) ctx.world);
deployerFakePlayer.getInventory()
.load(ctx.tileData.getList("Inventory", Constants.NBT.TAG_COMPOUND));
.load(ctx.tileData.getList("Inventory", Tag.TAG_COMPOUND));
ctx.temporaryData = fake = deployerFakePlayer;
ctx.tileData.remove("Inventory");
} else

View file

@ -29,6 +29,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
@ -49,7 +50,6 @@ import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
@ -315,8 +315,8 @@ public class DeployerTileEntity extends KineticTileEntity {
timer = compound.getInt("Timer");
redstoneLocked = compound.getBoolean("Powered");
deferredInventoryList = compound.getList("Inventory", NBT.TAG_COMPOUND);
overflowItems = NBTHelper.readItemList(compound.getList("Overflow", NBT.TAG_COMPOUND));
deferredInventoryList = compound.getList("Inventory", Tag.TAG_COMPOUND);
overflowItems = NBTHelper.readItemList(compound.getList("Overflow", Tag.TAG_COMPOUND));
if (compound.contains("HeldItem"))
heldItem = ItemStack.of(compound.getCompound("HeldItem"));
super.fromTag(compound, clientPacket);

View file

@ -4,8 +4,6 @@ import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.utility.AngleHelper;
import net.minecraft.core.Direction;

View file

@ -30,6 +30,7 @@ import net.minecraft.core.NonNullList;
import net.minecraft.core.particles.ItemParticleOption;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.Container;
@ -45,7 +46,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.RecipeWrapper;
@ -90,7 +90,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
super.fromTag(compound, clientPacket);
if (clientPacket) {
NBTHelper.iterateCompoundList(compound.getList("ParticleItems", NBT.TAG_COMPOUND),
NBTHelper.iterateCompoundList(compound.getList("ParticleItems", Tag.TAG_COMPOUND),
c -> pressedItems.add(ItemStack.of(c)));
spawnParticles();
}

View file

@ -4,7 +4,6 @@ import static net.minecraft.world.level.block.state.properties.BlockStatePropert
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.simibubi.create.AllBlockPartials;

View file

@ -25,7 +25,6 @@ import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import com.jozufozu.flywheel.backend.IFlywheelWorld;
import com.jozufozu.flywheel.light.GridAlignedBB;
import com.jozufozu.flywheel.light.ImmutableBox;
import com.simibubi.create.AllBlocks;
@ -69,7 +68,6 @@ import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.NBTProcessors;
import com.simibubi.create.foundation.utility.UniqueLinkedList;
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -109,8 +107,6 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.Constants.BlockFlags;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.IFluidHandler;
@ -705,30 +701,30 @@ public abstract class Contraption {
});
superglue.clear();
NBTHelper.iterateCompoundList(nbt.getList("Superglue", NBT.TAG_COMPOUND), c -> superglue.add(
NBTHelper.iterateCompoundList(nbt.getList("Superglue", Tag.TAG_COMPOUND), c -> superglue.add(
Pair.of(NbtUtils.readBlockPos(c.getCompound("Pos")), Direction.from3DDataValue(c.getByte("Direction")))));
seats.clear();
NBTHelper.iterateCompoundList(nbt.getList("Seats", NBT.TAG_COMPOUND), c -> seats.add(NbtUtils.readBlockPos(c)));
NBTHelper.iterateCompoundList(nbt.getList("Seats", Tag.TAG_COMPOUND), c -> seats.add(NbtUtils.readBlockPos(c)));
seatMapping.clear();
NBTHelper.iterateCompoundList(nbt.getList("Passengers", NBT.TAG_COMPOUND),
NBTHelper.iterateCompoundList(nbt.getList("Passengers", Tag.TAG_COMPOUND),
c -> seatMapping.put(NbtUtils.loadUUID(NBTHelper.getINBT(c, "Id")), c.getInt("Seat")));
stabilizedSubContraptions.clear();
NBTHelper.iterateCompoundList(nbt.getList("SubContraptions", NBT.TAG_COMPOUND),
NBTHelper.iterateCompoundList(nbt.getList("SubContraptions", Tag.TAG_COMPOUND),
c -> stabilizedSubContraptions.put(c.getUUID("Id"), BlockFace.fromNBT(c.getCompound("Location"))));
storage.clear();
NBTHelper.iterateCompoundList(nbt.getList("Storage", NBT.TAG_COMPOUND), c -> storage
NBTHelper.iterateCompoundList(nbt.getList("Storage", Tag.TAG_COMPOUND), c -> storage
.put(NbtUtils.readBlockPos(c.getCompound("Pos")), MountedStorage.deserialize(c.getCompound("Data"))));
fluidStorage.clear();
NBTHelper.iterateCompoundList(nbt.getList("FluidStorage", NBT.TAG_COMPOUND), c -> fluidStorage
NBTHelper.iterateCompoundList(nbt.getList("FluidStorage", Tag.TAG_COMPOUND), c -> fluidStorage
.put(NbtUtils.readBlockPos(c.getCompound("Pos")), MountedFluidStorage.deserialize(c.getCompound("Data"))));
interactors.clear();
NBTHelper.iterateCompoundList(nbt.getList("Interactors", NBT.TAG_COMPOUND), c -> {
NBTHelper.iterateCompoundList(nbt.getList("Interactors", Tag.TAG_COMPOUND), c -> {
BlockPos pos = NbtUtils.readBlockPos(c.getCompound("Pos"));
MovingInteractionBehaviour behaviour = AllInteractionBehaviours.of(getBlocks().get(pos).state.getBlock());
if (behaviour != null)
@ -977,8 +973,8 @@ public abstract class Contraption {
if (block.state.getBlock() != blockIn)
iterator.remove();
world.removeBlockEntity(add);
int flags = BlockFlags.IS_MOVING | BlockFlags.NO_NEIGHBOR_DROPS | BlockFlags.UPDATE_NEIGHBORS
| BlockFlags.BLOCK_UPDATE | BlockFlags.RERENDER_MAIN_THREAD;
int flags = Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_SUPPRESS_DROPS | Block.UPDATE_KNOWN_SHAPE
| Block.UPDATE_CLIENTS | Block.UPDATE_IMMEDIATE;
if (blockIn instanceof SimpleWaterloggedBlock && oldState.hasProperty(BlockStateProperties.WATERLOGGED)
&& oldState.getValue(BlockStateProperties.WATERLOGGED)) {
world.setBlock(add, Blocks.WATER.defaultBlockState(), flags);
@ -993,7 +989,7 @@ public abstract class Contraption {
// if (!shouldUpdateAfterMovement(block))
// continue;
int flags = BlockFlags.IS_MOVING | BlockFlags.DEFAULT;
int flags = Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL;
world.sendBlockUpdated(add, block.state, Blocks.AIR.defaultBlockState(), flags);
// when the blockstate is set to air, the block's POI data is removed, but
@ -1053,7 +1049,7 @@ public abstract class Contraption {
}
world.destroyBlock(targetPos, true);
world.setBlock(targetPos, state, 3 | BlockFlags.IS_MOVING);
world.setBlock(targetPos, state, Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL);
boolean verticalRotation = transform.rotationAxis == null || transform.rotationAxis.isHorizontal();
verticalRotation = verticalRotation && transform.rotation != Rotation.NONE;
@ -1102,7 +1098,7 @@ public abstract class Contraption {
continue;
BlockPos targetPos = transform.apply(block.pos);
world.markAndNotifyBlock(targetPos, world.getChunkAt(targetPos), block.state, block.state,
BlockFlags.IS_MOVING | BlockFlags.DEFAULT, 512);
Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL, 512);
}
for (int i = 0; i < inventory.getSlots(); i++) {
@ -1301,29 +1297,30 @@ public abstract class Contraption {
return maxDistSq;
}
private static class ContraptionTileWorld extends WrappedWorld implements IFlywheelWorld {
private final BlockEntity te;
private final StructureBlockInfo info;
public ContraptionTileWorld(Level world, BlockEntity te, StructureBlockInfo info) {
super(world);
this.te = te;
this.info = info;
}
@Override
public BlockState getBlockState(BlockPos pos) {
if (!pos.equals(te.getBlockPos()))
return Blocks.AIR.defaultBlockState();
return info.state;
}
@Override
public boolean isLoaded(BlockPos pos) {
return pos.equals(te.getBlockPos());
}
}
// TODO: unused?
// private static class ContraptionTileWorld extends WrappedWorld implements IFlywheelWorld {
//
// private final BlockEntity te;
// private final StructureBlockInfo info;
//
// public ContraptionTileWorld(Level world, BlockEntity te, StructureBlockInfo info) {
// super(world);
// this.te = te;
// this.info = info;
// }
//
// @Override
// public BlockState getBlockState(BlockPos pos) {
// if (!pos.equals(te.getBlockPos()))
// return Blocks.AIR.defaultBlockState();
// return info.state;
// }
//
// @Override
// public boolean isLoaded(BlockPos pos) {
// return pos.equals(te.getBlockPos());
// }
// }
public static class ContraptionInvWrapper extends CombinedInvWrapper {
protected final boolean isExternal;

View file

@ -13,11 +13,11 @@ import com.simibubi.create.foundation.utility.WorldAttached;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectLists;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.Constants.NBT;
public class ContraptionHandler {
@ -63,7 +63,7 @@ public class ContraptionHandler {
CompoundTag data = entityLiving.getPersistentData();
if (!data.contains("ContraptionDismountLocation"))
return;
Vec3 position = VecHelper.readNBT(data.getList("ContraptionDismountLocation", NBT.TAG_DOUBLE));
Vec3 position = VecHelper.readNBT(data.getList("ContraptionDismountLocation", Tag.TAG_DOUBLE));
if (entityLiving.getVehicle() == null)
entityLiving.teleportTo(position.x, position.y, position.z);
data.remove("ContraptionDismountLocation");

View file

@ -6,11 +6,11 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.Constants.NBT;
public class MovementContext {
@ -58,10 +58,10 @@ public class MovementContext {
public static MovementContext readNBT(Level world, StructureBlockInfo info, CompoundTag nbt, Contraption contraption) {
MovementContext context = new MovementContext(world, info, contraption);
context.motion = VecHelper.readNBT(nbt.getList("Motion", NBT.TAG_DOUBLE));
context.relativeMotion = VecHelper.readNBT(nbt.getList("RelativeMotion", NBT.TAG_DOUBLE));
context.motion = VecHelper.readNBT(nbt.getList("Motion", Tag.TAG_DOUBLE));
context.relativeMotion = VecHelper.readNBT(nbt.getList("RelativeMotion", Tag.TAG_DOUBLE));
if (nbt.contains("Position"))
context.position = VecHelper.readNBT(nbt.getList("Position", NBT.TAG_DOUBLE));
context.position = VecHelper.readNBT(nbt.getList("Position", Tag.TAG_DOUBLE));
context.stall = nbt.getBoolean("Stall");
context.firstMovement = nbt.getBoolean("FirstMovement");
context.data = nbt.getCompound("Data");

View file

@ -89,7 +89,7 @@ public class SailBlock extends WrenchableDirectionalBlock {
return InteractionResult.PASS;
DyeColor color = DyeColor.getColor(heldItem);
if (color != null && color != this.color) {
if (color != null) {
if (!world.isClientSide)
applyDye(state, world, pos, color);
return InteractionResult.SUCCESS;

View file

@ -4,8 +4,6 @@ import com.jozufozu.flywheel.backend.instancing.IDynamicInstance;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.AnimationTickHolder;

View file

@ -3,8 +3,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ga
import com.jozufozu.flywheel.backend.instancing.IDynamicInstance;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;

View file

@ -23,6 +23,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
@ -32,7 +33,6 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.PoweredRailBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.fmllegacy.network.PacketDistributor;
@ -425,8 +425,8 @@ public class MinecartController implements INBTSerializable<CompoundTag> {
static StallData read(CompoundTag nbt) {
StallData stallData = new StallData();
stallData.position = VecHelper.readNBT(nbt.getList("Pos", NBT.TAG_DOUBLE));
stallData.motion = VecHelper.readNBT(nbt.getList("Motion", NBT.TAG_DOUBLE));
stallData.position = VecHelper.readNBT(nbt.getList("Pos", Tag.TAG_DOUBLE));
stallData.motion = VecHelper.readNBT(nbt.getList("Motion", Tag.TAG_DOUBLE));
stallData.yaw = nbt.getFloat("Yaw");
stallData.pitch = nbt.getFloat("Pitch");
return stallData;

View file

@ -20,6 +20,7 @@ import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.FloatTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
@ -27,7 +28,6 @@ import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.DistExecutor;
@ -246,7 +246,7 @@ public class PipeConnection {
CompoundTag connectionData = tag.getCompound(side.getName());
if (connectionData.contains("Pressure")) {
ListTag pressureData = connectionData.getList("Pressure", NBT.TAG_FLOAT);
ListTag pressureData = connectionData.getList("Pressure", Tag.TAG_FLOAT);
pressure = Couple.create(pressureData.getFloat(0), pressureData.getFloat(1));
} else
pressure.replace(f -> 0f);

View file

@ -1,6 +1,5 @@
package com.simibubi.create.content.contraptions.fluids;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;

View file

@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.fluids.actors;
import java.util.Random;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;

View file

@ -4,8 +4,6 @@ import com.jozufozu.flywheel.backend.instancing.IDynamicInstance;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.contraptions.fluids.pipes;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;

View file

@ -27,7 +27,6 @@ import com.simibubi.create.foundation.utility.outliner.Outliner.OutlineEntry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
@ -40,18 +39,21 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.IIngameOverlay;
import net.minecraftforge.fmlclient.gui.GuiUtils;
public class GoggleOverlayRenderer {
public static final IIngameOverlay OVERLAY = GoggleOverlayRenderer::renderOverlay;
private static final List<Supplier<Boolean>> customGogglePredicates = new LinkedList<>();
private static final Map<Object, OutlineEntry> outlines = CreateClient.OUTLINER.getOutlines();
public static int hoverTicks = 0;
public static BlockPos lastHovered = null;
public static void renderOverlay(PoseStack ms, MultiBufferSource buffer, int light, int overlay,
float partialTicks) {
public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {
HitResult objectMouseOver = Minecraft.getInstance().hitResult;
if (!(objectMouseOver instanceof BlockHitResult)) {
@ -148,12 +150,9 @@ public class GoggleOverlayRenderer {
if (tooltip.isEmpty())
return;
ms.pushPose();
poseStack.pushPose();
Screen tooltipScreen = new TooltipScreen(new TextComponent(""));
tooltipScreen.init(mc, mc.getWindow()
.getGuiScaledWidth(),
mc.getWindow()
.getGuiScaledHeight());
tooltipScreen.init(mc, width, height);
int titleLinesCount = 1;
int tooltipTextWidth = 0;
@ -190,20 +189,20 @@ public class GoggleOverlayRenderer {
Theme.c(Theme.Key.VANILLA_TOOLTIP_BORDER, false).copy();
if (fade < 1) {
ms.translate((1 - fade) * Math.signum(cfg.overlayOffsetX.get() + .5f) * 4, 0, 0);
poseStack.translate((1 - fade) * Math.signum(cfg.overlayOffsetX.get() + .5f) * 4, 0, 0);
colorBackground.scaleAlpha(fade);
colorBorderTop.scaleAlpha(fade);
colorBorderBot.scaleAlpha(fade);
}
GuiUtils.drawHoveringText(ms, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1,
GuiUtils.drawHoveringText(poseStack, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1,
colorBackground.getRGB(), colorBorderTop.getRGB(), colorBorderBot.getRGB(), mc.font);
ItemStack item = AllItems.GOGGLES.asStack();
GuiGameElement.of(item)
.at(posX + 10, posY - 16, 450)
.render(ms);
ms.popPose();
.render(poseStack);
poseStack.popPose();
}
/**

View file

@ -4,7 +4,6 @@ import com.simibubi.create.foundation.utility.Color;
import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -15,28 +14,32 @@ public class SequencedAssemblyItem extends Item {
super(p_i48487_1_.stacksTo(1));
}
public float getProgress(ItemStack stack) {
if (!stack.hasTag())
return 0;
CompoundTag tag = stack.getTag();
if (!tag.contains("SequencedAssembly"))
return 0;
return tag.getCompound("SequencedAssembly")
.getFloat("Progress");
}
@Override
public void fillItemCategory(CreativeModeTab p_150895_1_, NonNullList<ItemStack> p_150895_2_) {}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
if (!stack.hasTag())
return 1;
CompoundTag tag = stack.getTag();
if (!tag.contains("SequencedAssembly"))
return 1;
return Mth.lerp(tag.getCompound("SequencedAssembly")
.getFloat("Progress"), 1, 0);
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
public boolean isBarVisible(ItemStack stack) {
return true;
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
return Color.mixColors(0xFF_46FFE0, 0xFF_FFC074, (float) getDurabilityForDisplay(stack));
public int getBarWidth(ItemStack stack) {
return Math.round(getProgress(stack) * 13);
}
@Override
public int getBarColor(ItemStack stack) {
return Color.mixColors(0xFF_FFC074, 0xFF_46FFE0, getProgress(stack));
}
}

View file

@ -72,9 +72,9 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
if (speed < 0 && axis.isVertical())
angle += 180;
Vec3 position = VecHelper.rotate(this.offset.scale(radius), angle, axis).add(origin);
x = position.x;
y = position.y;
z = position.z;
this.x = position.x;
this.y = position.y;
this.z = position.z;
}
public static class Factory implements ParticleProvider<RotationIndicatorParticleData> {

View file

@ -37,7 +37,7 @@ public class RotationIndicatorParticleData
@Override
public String toString() {
return "Bool";
return "Char";
}
};

View file

@ -43,6 +43,7 @@ import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack;
@ -52,7 +53,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -149,18 +149,18 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
if (compound.contains("PreferredSpoutput"))
preferredSpoutput = NBTHelper.readEnum(compound, "PreferredSpoutput", Direction.class);
disabledSpoutputs.clear();
ListTag disabledList = compound.getList("DisabledSpoutput", NBT.TAG_STRING);
ListTag disabledList = compound.getList("DisabledSpoutput", Tag.TAG_STRING);
disabledList.forEach(d -> disabledSpoutputs.add(Direction.valueOf(((StringTag) d).getAsString())));
spoutputBuffer = NBTHelper.readItemList(compound.getList("Overflow", NBT.TAG_COMPOUND));
spoutputFluidBuffer = NBTHelper.readCompoundList(compound.getList("FluidOverflow", NBT.TAG_COMPOUND),
spoutputBuffer = NBTHelper.readItemList(compound.getList("Overflow", Tag.TAG_COMPOUND));
spoutputFluidBuffer = NBTHelper.readCompoundList(compound.getList("FluidOverflow", Tag.TAG_COMPOUND),
FluidStack::loadFluidStackFromNBT);
if (!clientPacket)
return;
NBTHelper.iterateCompoundList(compound.getList("VisualizedItems", NBT.TAG_COMPOUND),
NBTHelper.iterateCompoundList(compound.getList("VisualizedItems", Tag.TAG_COMPOUND),
c -> visualizedOutputItems.add(IntAttached.with(OUTPUT_ANIMATION_TIME, ItemStack.of(c))));
NBTHelper.iterateCompoundList(compound.getList("VisualizedFluids", NBT.TAG_COMPOUND),
NBTHelper.iterateCompoundList(compound.getList("VisualizedFluids", Tag.TAG_COMPOUND),
c -> visualizedOutputFluids
.add(IntAttached.with(OUTPUT_ANIMATION_TIME, FluidStack.loadFluidStackFromNBT(c))));
}

View file

@ -5,8 +5,8 @@ import com.simibubi.create.foundation.networking.TileEntityConfigurationPacket;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.common.util.Constants.NBT;
public class ConfigureSequencedGearshiftPacket extends TileEntityConfigurationPacket<SequencedGearshiftTileEntity> {
@ -23,7 +23,7 @@ public class ConfigureSequencedGearshiftPacket extends TileEntityConfigurationPa
@Override
protected void readSettings(FriendlyByteBuf buffer) {
instructions = buffer.readNbt().getList("data", NBT.TAG_COMPOUND);
instructions = buffer.readNbt().getList("data", Tag.TAG_COMPOUND);
}
@Override

View file

@ -7,9 +7,9 @@ import com.simibubi.create.content.contraptions.relays.encased.SplitShaftTileEnt
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.util.Constants.NBT;
public class SequencedGearshiftTileEntity extends SplitShaftTileEntity {
@ -152,7 +152,7 @@ public class SequencedGearshiftTileEntity extends SplitShaftTileEntity {
currentInstructionProgress = compound.getFloat("InstructionProgress");
poweredPreviously = compound.getBoolean("PrevPowered");
timer = compound.getInt("Timer");
instructions = Instruction.deserializeAll(compound.getList("Instructions", NBT.TAG_COMPOUND));
instructions = Instruction.deserializeAll(compound.getList("Instructions", Tag.TAG_COMPOUND));
super.fromTag(compound, clientPacket);
}

View file

@ -24,10 +24,13 @@ import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.render.DestroyProgressRenderingHandler;
import com.simibubi.create.foundation.block.render.ReducedDestroyEffects;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
@ -95,7 +98,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
@OnlyIn(Dist.CLIENT)
public void initializeClient(Consumer<IBlockRenderProperties> consumer) {
consumer.accept(new ReducedDestroyEffects());
consumer.accept(new RenderProperties());
}
@Override
@ -600,4 +603,17 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
return false;
}
public static class RenderProperties extends ReducedDestroyEffects implements DestroyProgressRenderingHandler {
@Override
public boolean renderDestroyProgress(ClientLevel level, LevelRenderer renderer, int breakerId, BlockPos pos, int progress, BlockState blockState) {
BlockEntity blockEntity = level.getBlockEntity(pos);
if (blockEntity instanceof BeltTileEntity belt) {
for (BlockPos beltPos : BeltBlock.getBeltChain(level, belt.getController())) {
renderer.destroyBlockProgress(beltPos.hashCode(), beltPos, progress);
}
}
return false;
}
}
}

View file

@ -7,7 +7,6 @@ import com.jozufozu.flywheel.backend.instancing.InstanceData;
import com.jozufozu.flywheel.backend.instancing.Instancer;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Quaternion;

View file

@ -41,7 +41,6 @@ import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.Constants.BlockFlags;
public class BeltSlicer {
@ -92,7 +91,7 @@ public class BeltSlicer {
BeltTileEntity segmentTE = BeltHelper.getSegmentTE(world, next);
KineticTileEntity.switchToBlockState(world, next,
state.setValue(BeltBlock.CASING, segmentTE != null && segmentTE.casing != CasingType.NONE));
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3 | BlockFlags.IS_MOVING);
world.setBlock(pos, Blocks.AIR.defaultBlockState(), Block.UPDATE_ALL | Block.UPDATE_MOVE_BY_PISTON);
world.removeBlockEntity(pos);
world.levelEvent(2001, pos, Block.getId(state));
@ -287,7 +286,7 @@ public class BeltSlicer {
belt.beltLength = 0;
belt.color = color;
if (flipBelt)
world.setBlock(blockPos, flipBelt(world.getBlockState(blockPos)), 3 | BlockFlags.IS_MOVING);
world.setBlock(blockPos, flipBelt(world.getBlockState(blockPos)), Block.UPDATE_ALL | Block.UPDATE_MOVE_BY_PISTON);
}
// Reverse items
@ -317,7 +316,7 @@ public class BeltSlicer {
if (mergedController == null) {
// Attach at end
world.setBlock(next, state.setValue(BeltBlock.CASING, false), 3 | BlockFlags.IS_MOVING);
world.setBlock(next, state.setValue(BeltBlock.CASING, false), Block.UPDATE_ALL | Block.UPDATE_MOVE_BY_PISTON);
BeltTileEntity segmentTE = BeltHelper.getSegmentTE(world, next);
if (segmentTE != null)
segmentTE.color = controllerTE.color;

View file

@ -25,11 +25,11 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.Constants.NBT;
public class BeltInventory {
@ -386,7 +386,7 @@ public class BeltInventory {
public void read(CompoundTag nbt) {
items.clear();
nbt.getList("Items", NBT.TAG_COMPOUND)
nbt.getList("Items", Tag.TAG_COMPOUND)
.forEach(inbt -> items.add(TransportedItemStack.read((CompoundTag) inbt)));
beltMovementPositive = nbt.getBoolean("PositiveOrder");
}

View file

@ -6,7 +6,6 @@ import com.jozufozu.flywheel.backend.instancing.IDynamicInstance;
import com.jozufozu.flywheel.backend.instancing.Instancer;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;

View file

@ -40,33 +40,29 @@ public class ChromaticCompoundItem extends Item {
super(properties);
}
@Override
public boolean shouldOverrideMultiplayerNbt() {
return true;
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
int light = stack.getOrCreateTag()
public int getLight(ItemStack stack) {
return stack.getOrCreateTag()
.getInt("CollectingLight");
return 1 - light / (float) AllConfigs.SERVER.recipes.lightSourceCountForRefinedRadiance.get();
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
int light = stack.getOrCreateTag()
.getInt("CollectingLight");
return light > 0;
public boolean isBarVisible(ItemStack stack) {
return getLight(stack) > 0;
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
return Color.mixColors(0x413c69, 0xFFFFFF, (float) (1 - getDurabilityForDisplay(stack)));
public int getBarWidth(ItemStack stack) {
return Math.round(13.0F * getLight(stack) / AllConfigs.SERVER.recipes.lightSourceCountForRefinedRadiance.get());
}
@Override
public int getBarColor(ItemStack stack) {
return Color.mixColors(0x413c69, 0xFFFFFF, getLight(stack) / (float) AllConfigs.SERVER.recipes.lightSourceCountForRefinedRadiance.get());
}
@Override
public int getItemStackLimit(ItemStack stack) {
return showDurabilityBar(stack) ? 1 : 16;
return isBarVisible(stack) ? 1 : 16;
}
@Override

View file

@ -70,36 +70,7 @@ public class BackTankUtil {
// For Air-using tools
@OnlyIn(Dist.CLIENT)
public static int getRGBDurabilityForDisplay(ItemStack stack, int usesPerTank) {
if (usesPerTank == 0)
return 0;
LocalPlayer player = Minecraft.getInstance().player;
if (player == null)
return 0;
ItemStack backtank = get(player);
if (backtank.isEmpty() || !hasAirRemaining(backtank))
return Mth.hsvToRgb(
Math.max(0.0F, (float) (1.0F - getDurabilityForDisplay(stack, usesPerTank))) / 3.0F, 1.0F, 1.0F);
return backtank.getItem()
.getRGBDurabilityForDisplay(backtank);
}
@OnlyIn(Dist.CLIENT)
public static double getDurabilityForDisplay(ItemStack stack, int usesPerTank) {
if (usesPerTank == 0)
return 0;
LocalPlayer player = Minecraft.getInstance().player;
if (player == null)
return 0;
ItemStack backtank = get(player);
if (backtank.isEmpty() || !hasAirRemaining(backtank))
return (double) stack.getDamageValue() / (double) stack.getMaxDamage();
return backtank.getItem()
.getDurabilityForDisplay(backtank);
}
@OnlyIn(Dist.CLIENT)
public static boolean showDurabilityBar(ItemStack stack, int usesPerTank) {
public static boolean isBarVisible(ItemStack stack, int usesPerTank) {
if (usesPerTank == 0)
return false;
LocalPlayer player = Minecraft.getInstance().player;
@ -111,4 +82,33 @@ public class BackTankUtil {
return true;
}
@OnlyIn(Dist.CLIENT)
public static int getBarWidth(ItemStack stack, int usesPerTank) {
if (usesPerTank == 0)
return 13;
LocalPlayer player = Minecraft.getInstance().player;
if (player == null)
return 13;
ItemStack backtank = get(player);
if (backtank.isEmpty() || !hasAirRemaining(backtank))
return Math.round(13.0F - (float) stack.getDamageValue() / stack.getMaxDamage() * 13.0F);
return backtank.getItem()
.getBarWidth(backtank);
}
@OnlyIn(Dist.CLIENT)
public static int getBarColor(ItemStack stack, int usesPerTank) {
if (usesPerTank == 0)
return 0;
LocalPlayer player = Minecraft.getInstance().player;
if (player == null)
return 0;
ItemStack backtank = get(player);
if (backtank.isEmpty() || !hasAirRemaining(backtank))
return Mth.hsvToRgb(
Math.max(0.0F, 1.0F - (float) stack.getDamageValue() / stack.getMaxDamage()) / 3.0F, 1.0F, 1.0F);
return backtank.getItem()
.getBarColor(backtank);
}
}

View file

@ -1,6 +1,5 @@
package com.simibubi.create.content.curiosities.armor;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
@ -17,7 +16,6 @@ import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Sheets;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
@ -34,9 +32,13 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.IIngameOverlay;
public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> {
public static final IIngameOverlay REMAINING_AIR_OVERLAY = CopperBacktankArmorLayer::renderRemainingAirOverlay;
public CopperBacktankArmorLayer(RenderLayerParent<T, M> renderer) {
super(renderer);
}
@ -103,7 +105,7 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
livingRenderer.addLayer((CopperBacktankArmorLayer) layer);
}
public static void renderRemainingAirOverlay(PoseStack ms, BufferSource buffers, int light, int overlay, float pt) {
public static void renderRemainingAirOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null)
return;
@ -118,24 +120,21 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
int timeLeft = player.getPersistentData()
.getInt("VisualBacktankAir");
ms.pushPose();
poseStack.pushPose();
Window window = Minecraft.getInstance()
.getWindow();
ms.translate(window.getGuiScaledWidth() / 2 + 90, window.getGuiScaledHeight() - 53, 0);
poseStack.translate(width / 2 + 90, height - 53, 0);
Component text = new TextComponent(StringUtil.formatTickDuration(timeLeft * 20));
GuiGameElement.of(AllItems.COPPER_BACKTANK.asStack())
.at(0, 0)
.render(ms);
.render(poseStack);
int color = 0xFF_FFFFFF;
if (timeLeft < 60 && timeLeft % 2 == 0) {
color = Color.mixColors(0xFF_FF0000, color, Math.max(timeLeft / 60f, .25f));
}
Minecraft.getInstance().font.drawShadow(ms, text, 16, 5, color);
buffers.endBatch();
Minecraft.getInstance().font.drawShadow(poseStack, text, 16, 5, color);
ms.popPose();
poseStack.popPose();
}
}

View file

@ -14,7 +14,7 @@ import net.minecraft.world.item.context.UseOnContext;
public class CopperBacktankItem extends CopperArmorItem implements ICapacityEnchantable {
public static final int DURABILITY_BAR = 0xefefef;
public static final int DURABILITY_BAR = 0xEFEFEF;
private BlockItem blockItem;
public CopperBacktankItem(Properties p_i48534_3_, BlockItem blockItem) {
@ -37,11 +37,6 @@ public class CopperBacktankItem extends CopperArmorItem implements ICapacityEnch
return true;
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
return DURABILITY_BAR;
}
@Override
public void fillItemCategory(CreativeModeTab p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
if (!allowdedIn(p_150895_1_))
@ -55,14 +50,18 @@ public class CopperBacktankItem extends CopperArmorItem implements ICapacityEnch
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
return 1 - Mth
.clamp(getRemainingAir(stack) / ((float) BackTankUtil.maxAir(stack)), 0, 1);
public boolean isBarVisible(ItemStack stack) {
return true;
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return true;
public int getBarWidth(ItemStack stack) {
return Math.round(13.0F * Mth.clamp(getRemainingAir(stack) / ((float) BackTankUtil.maxAir(stack)), 0, 1));
}
@Override
public int getBarColor(ItemStack stack) {
return DURABILITY_BAR;
}
public static int getRemainingAir(ItemStack stack) {

View file

@ -13,6 +13,7 @@ import net.minecraft.core.Direction.Axis;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.Mth;
@ -22,7 +23,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.Constants.NBT;
public class CopperBacktankTileEntity extends KineticTileEntity implements Nameable {
@ -101,7 +101,7 @@ public class CopperBacktankTileEntity extends KineticTileEntity implements Namea
capacityEnchantLevel = compound.getInt("CapacityEnchantment");
airLevel = compound.getInt("Air");
airLevelTimer = compound.getInt("Timer");
enchantmentTag = compound.getList("Enchantments", NBT.TAG_COMPOUND);
enchantmentTag = compound.getList("Enchantments", Tag.TAG_COMPOUND);
if (compound.contains("CustomName", 8))
this.customName = Component.Serializer.fromJson(compound.getString("CustomName"));
if (prev != 0 && prev != airLevel && airLevel == BackTankUtil.maxAir(capacityEnchantLevel) && clientPacket)

View file

@ -47,7 +47,6 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IItemRenderProperties;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.common.util.Constants.BlockFlags;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fmllegacy.network.PacketDistributor;
@ -254,7 +253,7 @@ public class SymmetryWandItem extends Item {
BlockSnapshot blocksnapshot = BlockSnapshot.create(world.dimension(), world, position);
FluidState ifluidstate = world.getFluidState(position);
world.setBlock(position, ifluidstate.createLegacyBlock(), BlockFlags.UPDATE_NEIGHBORS);
world.setBlock(position, ifluidstate.createLegacyBlock(), Block.UPDATE_KNOWN_SHAPE);
world.setBlockAndUpdate(position, blockState);
CompoundTag wandNbt = wand.getOrCreateTag();

View file

@ -24,7 +24,6 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import net.minecraft.world.item.DyeColor;
@ -32,10 +31,6 @@ import net.minecraft.world.item.ItemStack;
public class RadialToolboxMenu extends AbstractSimiScreen {
public static enum State {
SELECT_BOX, SELECT_ITEM, SELECT_ITEM_UNEQUIP, DETACH
}
private State state;
private int ticksOpen;
private int hoveredSlot;
@ -248,13 +243,13 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
if (state == State.DETACH) {
if (selected == UNEQUIP)
AllPackets.channel.sendToServer(
new ToolboxEquipPacket(null, selected, Minecraft.getInstance().player.getInventory().selected));
new ToolboxEquipPacket(null, selected, minecraft.player.getInventory().selected));
return;
}
if (selected == UNEQUIP)
AllPackets.channel.sendToServer(new ToolboxEquipPacket(selectedBox.getBlockPos(), selected,
Minecraft.getInstance().player.getInventory().selected));
minecraft.player.getInventory().selected));
if (selected < 0)
return;
@ -267,7 +262,7 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
return;
AllPackets.channel.sendToServer(new ToolboxEquipPacket(selectedBox.getBlockPos(), selected,
Minecraft.getInstance().player.getInventory().selected));
minecraft.player.getInventory().selected));
}
@Override
@ -307,7 +302,7 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
@Override
public boolean mouseClicked(double x, double y, int button) {
int selected = (scrollMode ? scrollSlot : hoveredSlot);
int selected = scrollMode ? scrollSlot : hoveredSlot;
if (button == 0) {
if (selected == DEPOSIT) {
@ -340,7 +335,7 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
if (state == State.SELECT_ITEM_UNEQUIP && selected == UNEQUIP) {
if (toolboxes.size() > 1) {
AllPackets.channel.sendToServer(new ToolboxEquipPacket(selectedBox.getBlockPos(), selected,
Minecraft.getInstance().player.getInventory().selected));
minecraft.player.getInventory().selected));
state = State.SELECT_BOX;
return true;
}
@ -355,10 +350,18 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
}
@Override
public boolean keyPressed(int code, int p_keyPressed_2_, int p_keyPressed_3_) {
public boolean keyPressed(int code, int scanCode, int modifiers) {
InputConstants.Key mouseKey = InputConstants.getKey(code, scanCode);
if (AllKeys.TOOLBELT.getKeybind()
.isActiveAndMatches(mouseKey)) {
onClose();
ToolboxHandlerClient.COOLDOWN = 2;
return true;
}
KeyMapping[] hotbarBinds = minecraft.options.keyHotbarSlots;
for (int i = 0; i < hotbarBinds.length && i < 8; i++) {
if (hotbarBinds[i].matches(code, p_keyPressed_2_)) {
if (hotbarBinds[i].matches(code, scanCode)) {
if (state == State.SELECT_ITEM || state == State.SELECT_ITEM_UNEQUIP) {
ToolboxInventory inv = selectedBox.inventory;
@ -379,18 +382,11 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
}
}
return super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_);
return super.keyPressed(code, scanCode, modifiers);
}
@Override
public boolean keyReleased(int code, int p_keyPressed_2_, int p_keyPressed_3_) {
InputConstants.Key mouseKey = InputConstants.getKey(code, p_keyPressed_2_);
if (AllKeys.TOOLBELT.getKeybind()
.isActiveAndMatches(mouseKey)) {
this.onClose();
return true;
}
return super.keyReleased(code, p_keyPressed_2_, p_keyPressed_3_);
public static enum State {
SELECT_BOX, SELECT_ITEM, SELECT_ITEM_UNEQUIP, DETACH
}
}

View file

@ -9,7 +9,6 @@ import java.util.Collections;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllKeys;
@ -19,7 +18,6 @@ import com.simibubi.create.foundation.networking.AllPackets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
@ -33,9 +31,13 @@ import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.IIngameOverlay;
public class ToolboxHandlerClient {
public static final IIngameOverlay OVERLAY = ToolboxHandlerClient::renderOverlay;
static int COOLDOWN = 0;
public static void clientTick() {
@ -151,12 +153,9 @@ public class ToolboxHandlerClient {
ScreenOpener.open(new RadialToolboxMenu(toolboxes, RadialToolboxMenu.State.SELECT_BOX, null));
}
public static void renderOverlay(PoseStack ms, MultiBufferSource buffer, int light, int overlay,
float partialTicks) {
Window mainWindow = Minecraft.getInstance()
.getWindow();
int x = mainWindow.getGuiScaledWidth() / 2 - 90;
int y = mainWindow.getGuiScaledHeight() - 23;
public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {
int x = width / 2 - 90;
int y = height - 23;
RenderSystem.enableDepthTest();
Player player = Minecraft.getInstance().player;
@ -170,7 +169,7 @@ public class ToolboxHandlerClient {
if (compound.isEmpty())
return;
ms.pushPose();
poseStack.pushPose();
for (int slot = 0; slot < 9; slot++) {
String key = String.valueOf(slot);
if (!compound.contains(key))
@ -183,9 +182,9 @@ public class ToolboxHandlerClient {
AllGuiTextures texture = ToolboxHandler.distance(player.position(), pos) < max * max
? selected ? TOOLBELT_SELECTED_ON : TOOLBELT_HOTBAR_ON
: selected ? TOOLBELT_SELECTED_OFF : TOOLBELT_HOTBAR_OFF;
texture.render(ms, x + 20 * slot - offset, y + offset);
texture.render(poseStack, x + 20 * slot - offset, y + offset);
}
ms.popPose();
poseStack.popPose();
}
}

View file

@ -11,10 +11,10 @@ import com.simibubi.create.AllTags.AllItemTags;
import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.ShulkerBoxBlock;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler;
@ -152,7 +152,7 @@ public class ToolboxInventory extends ItemStackHandler {
@Override
public void deserializeNBT(CompoundTag nbt) {
filters = NBTHelper.readItemList(nbt.getList("Compartments", NBT.TAG_COMPOUND));
filters = NBTHelper.readItemList(nbt.getList("Compartments", Tag.TAG_COMPOUND));
if (filters.size() != 8) {
filters.clear();
for (int i = 0; i < 8; i++)

View file

@ -22,7 +22,6 @@ import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.tags.ItemTags;
@ -37,12 +36,15 @@ import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.HitResult.Type;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.IIngameOverlay;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler;
public class BlueprintOverlayRenderer {
public static final IIngameOverlay OVERLAY = BlueprintOverlayRenderer::renderOverlay;
static boolean active;
static boolean empty;
static boolean lastSneakState;
@ -204,42 +206,39 @@ public class BlueprintOverlayRenderer {
}
}
public static void renderOverlay(PoseStack ms, MultiBufferSource buffer, int light, int overlay,
float partialTicks) {
public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {
if (!active || empty)
return;
Minecraft mc = Minecraft.getInstance();
int w = 30 + 21 * ingredients.size() + 21;
int x = (mc.getWindow()
.getGuiScaledWidth() - w) / 2;
int y = (int) (mc.getWindow()
.getGuiScaledHeight() / 3f * 2);
int x = (width - w) / 2;
int y = (int) (height / 3f * 2);
for (Pair<ItemStack, Boolean> pair : ingredients) {
RenderSystem.enableBlend();
(pair.getSecond() ? AllGuiTextures.HOTSLOT_ACTIVE : AllGuiTextures.HOTSLOT).render(ms, x, y);
(pair.getSecond() ? AllGuiTextures.HOTSLOT_ACTIVE : AllGuiTextures.HOTSLOT).render(poseStack, x, y);
ItemStack itemStack = pair.getFirst();
String count = pair.getSecond() ? null : ChatFormatting.GOLD.toString() + itemStack.getCount();
drawItemStack(ms, mc, x, y, itemStack, count);
drawItemStack(poseStack, mc, x, y, itemStack, count);
x += 21;
}
x += 5;
RenderSystem.enableBlend();
AllGuiTextures.HOTSLOT_ARROW.render(ms, x, y + 4);
AllGuiTextures.HOTSLOT_ARROW.render(poseStack, x, y + 4);
x += 25;
if (result.isEmpty()) {
AllGuiTextures.HOTSLOT.render(ms, x, y);
AllGuiTextures.HOTSLOT.render(poseStack, x, y);
GuiGameElement.of(Items.BARRIER)
.at(x + 3, y + 3)
.render(ms);
.render(poseStack);
} else {
(resultCraftable ? AllGuiTextures.HOTSLOT_SUPER_ACTIVE : AllGuiTextures.HOTSLOT).render(ms,
(resultCraftable ? AllGuiTextures.HOTSLOT_SUPER_ACTIVE : AllGuiTextures.HOTSLOT).render(poseStack,
resultCraftable ? x - 1 : x, resultCraftable ? y - 1 : y);
drawItemStack(ms, mc, x, y, result, null);
drawItemStack(poseStack, mc, x, y, result, null);
}
}
@ -275,7 +274,7 @@ public class BlueprintOverlayRenderer {
if (AllItems.ATTRIBUTE_FILTER.isIn(itemStack)) {
WhitelistMode whitelistMode = WhitelistMode.values()[tag.getInt("WhitelistMode")];
ListTag attributes = tag.getList("MatchedAttributes", NBT.TAG_COMPOUND);
ListTag attributes = tag.getList("MatchedAttributes", net.minecraft.nbt.Tag.TAG_COMPOUND);
if (whitelistMode == WhitelistMode.WHITELIST_DISJ && attributes.size() == 1) {
ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0));
if (fromNBT instanceof ItemAttribute.InTag) {

View file

@ -215,18 +215,18 @@ public class ExtendoGripItem extends Item {
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
return BackTankUtil.getRGBDurabilityForDisplay(stack, maxUses());
public boolean isBarVisible(ItemStack stack) {
return BackTankUtil.isBarVisible(stack, maxUses());
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
return BackTankUtil.getDurabilityForDisplay(stack, maxUses());
public int getBarWidth(ItemStack stack) {
return BackTankUtil.getBarWidth(stack, maxUses());
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return BackTankUtil.showDurabilityBar(stack, maxUses());
public int getBarColor(ItemStack stack) {
return BackTankUtil.getBarColor(stack, maxUses());
}
private static int maxUses() {

View file

@ -1,6 +1,5 @@
package com.simibubi.create.content.curiosities.tools;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;

View file

@ -87,18 +87,18 @@ public class PotatoCannonItem extends ProjectileWeaponItem {
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
return BackTankUtil.getRGBDurabilityForDisplay(stack, maxUses());
public boolean isBarVisible(ItemStack stack) {
return BackTankUtil.isBarVisible(stack, maxUses());
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
return BackTankUtil.getDurabilityForDisplay(stack, maxUses());
public int getBarWidth(ItemStack stack) {
return BackTankUtil.getBarWidth(stack, maxUses());
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return BackTankUtil.showDurabilityBar(stack, maxUses());
public int getBarColor(ItemStack stack) {
return BackTankUtil.getBarColor(stack, maxUses());
}
private int maxUses() {

View file

@ -17,6 +17,7 @@ import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.InteractionHand;
@ -40,7 +41,6 @@ import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.fml.DistExecutor;
public abstract class ZapperItem extends Item {
@ -138,7 +138,7 @@ public abstract class ZapperItem extends Item {
stateToUse = NbtUtils.readBlockState(nbt.getCompound("BlockUsed"));
stateToUse = BlockHelper.setZeroAge(stateToUse);
CompoundTag data = null;
if (AllBlockTags.SAFE_NBT.matches(stateToUse) && nbt.contains("BlockData", NBT.TAG_COMPOUND)) {
if (AllBlockTags.SAFE_NBT.matches(stateToUse) && nbt.contains("BlockData", Tag.TAG_COMPOUND)) {
data = nbt.getCompound("BlockData");
}

View file

@ -20,11 +20,11 @@ import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.util.Constants;
public class WorldshaperScreen extends ZapperScreen {
@ -59,7 +59,7 @@ public class WorldshaperScreen extends ZapperScreen {
CompoundTag nbt = zapper.getOrCreateTag();
currentBrush = NBTHelper.readEnum(nbt, "Brush", TerrainBrushes.class);
if (nbt.contains("BrushParams", Constants.NBT.TAG_COMPOUND)) {
if (nbt.contains("BrushParams", Tag.TAG_COMPOUND)) {
BlockPos paramsData = NbtUtils.readBlockPos(nbt.getCompound("BrushParams"));
currentBrushParams[0] = paramsData.getX();
currentBrushParams[1] = paramsData.getY();

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.logistics.block.belts.tunnel;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;

View file

@ -35,7 +35,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.items.CapabilityItemHandler;
@ -80,13 +79,13 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements IInstanceRe
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
Set<Direction> newFlaps = new HashSet<>(6);
ListTag flapsNBT = compound.getList("Flaps", NBT.TAG_INT);
ListTag flapsNBT = compound.getList("Flaps", Tag.TAG_INT);
for (Tag inbt : flapsNBT)
if (inbt instanceof IntTag)
newFlaps.add(Direction.from3DDataValue(((IntTag) inbt).getAsInt()));
sides.clear();
ListTag sidesNBT = compound.getList("Sides", NBT.TAG_INT);
ListTag sidesNBT = compound.getList("Sides", Tag.TAG_INT);
for (Tag inbt : sidesNBT)
if (inbt instanceof IntTag)
sides.add(Direction.from3DDataValue(((IntTag) inbt).getAsInt()));

View file

@ -39,6 +39,7 @@ import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.entity.item.ItemEntity;
@ -48,7 +49,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@ -596,7 +596,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity implements IHave
for (boolean filtered : Iterate.trueAndFalse) {
distributionTargets.set(filtered, NBTHelper
.readCompoundList(compound.getList(filtered ? "FilteredTargets" : "Targets", NBT.TAG_COMPOUND), nbt -> {
.readCompoundList(compound.getList(filtered ? "FilteredTargets" : "Targets", Tag.TAG_COMPOUND), nbt -> {
BlockPos pos = NbtUtils.readBlockPos(nbt.getCompound("Pos"));
Direction face = Direction.from3DDataValue(nbt.getInt("Face"));
return Pair.of(pos, face);

View file

@ -1,6 +1,5 @@
package com.simibubi.create.content.logistics.block.chute;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.content.logistics.block.chute.ChuteBlock.Shape;

View file

@ -27,13 +27,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.Containers;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler;
@ -204,7 +204,7 @@ public class DepotBehaviour extends TileEntityBehaviour {
heldItem = TransportedItemStack.read(compound.getCompound("HeldItem"));
processingOutputBuffer.deserializeNBT(compound.getCompound("OutputBuffer"));
if (canMergeItems()) {
ListTag list = compound.getList("Incoming", NBT.TAG_COMPOUND);
ListTag list = compound.getList("Incoming", Tag.TAG_COMPOUND);
incoming = NBTHelper.readCompoundList(list, TransportedItemStack::read);
}
}

View file

@ -3,8 +3,6 @@ package com.simibubi.create.content.logistics.block.depot;
import com.jozufozu.flywheel.backend.instancing.IDynamicInstance;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;
import com.simibubi.create.foundation.utility.AnimationTickHolder;

View file

@ -34,6 +34,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
@ -60,7 +61,6 @@ import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.ItemStackHandler;
@ -532,13 +532,13 @@ public class EjectorTileEntity extends KineticTileEntity {
powered = compound.getBoolean("Powered");
state = NBTHelper.readEnum(compound, "State", State.class);
lidProgress.readNBT(compound.getCompound("Lid"), false);
launchedItems = NBTHelper.readCompoundList(compound.getList("LaunchedItems", NBT.TAG_COMPOUND),
launchedItems = NBTHelper.readCompoundList(compound.getList("LaunchedItems", Tag.TAG_COMPOUND),
nbt -> IntAttached.read(nbt, ItemStack::of));
earlyTarget = null;
earlyTargetTime = 0;
if (compound.contains("EarlyTarget")) {
earlyTarget = Pair.of(VecHelper.readNBT(compound.getList("EarlyTarget", NBT.TAG_DOUBLE)),
earlyTarget = Pair.of(VecHelper.readNBT(compound.getList("EarlyTarget", Tag.TAG_DOUBLE)),
NbtUtils.readBlockPos(compound.getCompound("EarlyTargetPos")));
earlyTargetTime = compound.getFloat("EarlyTargetTime");
}

View file

@ -5,8 +5,6 @@ import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.Color;

View file

@ -2,7 +2,6 @@ package com.simibubi.create.content.logistics.block.funnel;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;

View file

@ -8,11 +8,11 @@ import com.simibubi.create.foundation.networking.SimplePacketBase;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.fmllegacy.network.NetworkEvent.Context;
public class ArmPlacementPacket extends SimplePacketBase {
@ -28,7 +28,7 @@ public class ArmPlacementPacket extends SimplePacketBase {
public ArmPlacementPacket(FriendlyByteBuf buffer) {
CompoundTag nbt = buffer.readNbt();
receivedTag = nbt.getList("Points", NBT.TAG_COMPOUND);
receivedTag = nbt.getList("Points", Tag.TAG_COMPOUND);
pos = buffer.readBlockPos();
}

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.logistics.block.mechanicalArm;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;

View file

@ -42,7 +42,6 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.Constants.NBT;
public class ArmTileEntity extends KineticTileEntity implements ITransformableTE {
@ -478,7 +477,7 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE
phase = NBTHelper.readEnum(compound, "Phase", Phase.class);
chasedPointIndex = compound.getInt("TargetPointIndex");
chasedPointProgress = compound.getFloat("MovementProgress");
interactionPointTag = compound.getList("InteractionPoints", NBT.TAG_COMPOUND);
interactionPointTag = compound.getList("InteractionPoints", Tag.TAG_COMPOUND);
redstoneLocked = compound.getBoolean("Powered");
if (!clientPacket)

View file

@ -6,9 +6,7 @@ import com.jozufozu.flywheel.backend.material.Material;
import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.Rotate;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.jozufozu.flywheel.util.transform.Translate;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.AnimationTickHolder;

View file

@ -16,6 +16,7 @@ import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.TextComponent;
@ -26,7 +27,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.Constants.NBT;
public class NixieTubeTileEntity extends SmartTileEntity {
@ -85,7 +85,7 @@ public class NixieTubeTileEntity extends SmartTileEntity {
public void displayCustomNameOf(ItemStack stack, int nixiePositionInRow) {
CompoundTag compoundnbt = stack.getTagElement("display");
if (compoundnbt != null && compoundnbt.contains("Name", NBT.TAG_STRING)) {
if (compoundnbt != null && compoundnbt.contains("Name", Tag.TAG_STRING)) {
hasCustomText = true;
rawCustomText = getJsonFromString(compoundnbt.getString("Name"));
customTextIndex = nixiePositionInRow;
@ -117,7 +117,7 @@ public class NixieTubeTileEntity extends SmartTileEntity {
protected void fromTag(CompoundTag nbt, boolean clientPacket) {
super.fromTag(nbt, clientPacket);
if (nbt.contains("RawCustomText", NBT.TAG_STRING)) {
if (nbt.contains("RawCustomText", Tag.TAG_STRING)) {
rawCustomText = getJsonFromString(nbt.getString("RawCustomText"));
// Check if string forms valid JSON
if (rawCustomText != null && !rawCustomText.isJsonNull()) {

View file

@ -1,6 +1,5 @@
package com.simibubi.create.content.logistics.item;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems;

View file

@ -27,14 +27,17 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.Options;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.IIngameOverlay;
public class LinkedControllerClientHandler {
public static final IIngameOverlay OVERLAY = LinkedControllerClientHandler::renderOverlay;
public static Mode MODE = Mode.IDLE;
public static int PACKET_RATE = 5;
public static Collection<Integer> currentlyPressed = new HashSet<>();
@ -227,18 +230,14 @@ public class LinkedControllerClientHandler {
controls.forEach(kb -> kb.setDown(false));
}
public static void renderOverlay(PoseStack ms, MultiBufferSource buffer, int light, int overlay,
float partialTicks) {
public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width1, int height1) {
if (MODE != Mode.BIND)
return;
Minecraft mc = Minecraft.getInstance();
ms.pushPose();
poseStack.pushPose();
Screen tooltipScreen = new TooltipScreen(null);
tooltipScreen.init(mc, mc.getWindow()
.getGuiScaledWidth(),
mc.getWindow()
.getGuiScaledHeight());
tooltipScreen.init(mc, width1, height1);
Object[] keys = new Object[6];
Vector<KeyMapping> controls = getControls();
@ -262,10 +261,9 @@ public class LinkedControllerClientHandler {
int x = (tooltipScreen.width / 3) - width / 2;
int y = tooltipScreen.height - height;
tooltipScreen.renderComponentTooltip(ms, list, x, y);
ms.popPose();
tooltipScreen.renderComponentTooltip(poseStack, list, x, y);
poseStack.popPose();
}
public enum Mode {

View file

@ -2,7 +2,6 @@ package com.simibubi.create.content.logistics.item;
import java.util.Vector;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems;

View file

@ -9,6 +9,7 @@ import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.player.Inventory;
@ -18,7 +19,6 @@ import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.SlotItemHandler;
@ -132,7 +132,7 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
whitelistMode = WhitelistMode.values()[filterItem.getOrCreateTag()
.getInt("WhitelistMode")];
ListTag attributes = filterItem.getOrCreateTag()
.getList("MatchedAttributes", NBT.TAG_COMPOUND);
.getList("MatchedAttributes", Tag.TAG_COMPOUND);
attributes.forEach(inbt -> {
CompoundTag compound = (CompoundTag) inbt;
selectedAttributes.add(Pair.of(ItemAttribute.fromNBT(compound), compound.getBoolean("Inverted")));

View file

@ -35,7 +35,6 @@ import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fmllegacy.network.NetworkHooks;
import net.minecraftforge.items.ItemHandlerHelper;
@ -120,7 +119,7 @@ public class FilterItem extends Item implements MenuProvider {
int count = 0;
ListTag attributes = filter.getOrCreateTag()
.getList("MatchedAttributes", NBT.TAG_COMPOUND);
.getList("MatchedAttributes", Tag.TAG_COMPOUND);
for (Tag inbt : attributes) {
CompoundTag compound = (CompoundTag) inbt;
ItemAttribute attribute = ItemAttribute.fromNBT(compound);
@ -216,7 +215,7 @@ public class FilterItem extends Item implements MenuProvider {
WhitelistMode whitelistMode = WhitelistMode.values()[filter.getOrCreateTag()
.getInt("WhitelistMode")];
ListTag attributes = filter.getOrCreateTag()
.getList("MatchedAttributes", NBT.TAG_COMPOUND);
.getList("MatchedAttributes", Tag.TAG_COMPOUND);
for (Tag inbt : attributes) {
CompoundTag compound = (CompoundTag) inbt;
ItemAttribute attribute = ItemAttribute.fromNBT(compound);

View file

@ -13,12 +13,12 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction.Axis;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.util.Constants;
public abstract class LaunchedItem {
@ -111,7 +111,7 @@ public abstract class LaunchedItem {
void readNBT(CompoundTag nbt) {
super.readNBT(nbt);
state = NbtUtils.readBlockState(nbt.getCompound("BlockState"));
if (nbt.contains("Data", Constants.NBT.TAG_COMPOUND)) {
if (nbt.contains("Data", Tag.TAG_COMPOUND)) {
data = nbt.getCompound("Data");
}
}

View file

@ -23,7 +23,6 @@ import com.simibubi.create.foundation.utility.outliner.AABBOutline;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.nbt.CompoundTag;
@ -40,6 +39,8 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlac
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.IIngameOverlay;
public class SchematicHandler {
@ -60,6 +61,8 @@ public class SchematicHandler {
private SchematicHotbarSlotOverlay overlay;
private ToolSelectionScreen selectionScreen;
private final IIngameOverlay overlayRenderer = this::renderOverlay;
public SchematicHandler() {
renderers = new Vector<>(3);
for (int i = 0; i < renderers.capacity(); i++)
@ -194,16 +197,20 @@ public class SchematicHandler {
}
public void renderOverlay(PoseStack ms, MultiBufferSource buffer, int light, int overlay, float partialTicks) {
public IIngameOverlay getOverlayRenderer() {
return overlayRenderer;
}
public void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {
if (!active)
return;
if (activeSchematicItem != null)
this.overlay.renderOn(ms, activeHotbarSlot);
this.overlay.renderOn(poseStack, activeHotbarSlot);
currentTool.getTool()
.renderOverlay(ms, buffer);
selectionScreen.renderPassive(ms, partialTicks);
.renderOverlay(gui, poseStack, partialTicks, width, height);
selectionScreen.renderPassive(poseStack, partialTicks);
}
public void onMouseInput(int button, boolean pressed) {
if (!active)
return;

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraftforge.client.gui.ForgeIngameGui;
public interface ISchematicTool {
@ -14,7 +14,7 @@ public interface ISchematicTool {
public boolean handleMouseWheel(double delta);
public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer);
public void renderOverlay(PoseStack ms, MultiBufferSource buffer);
public void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height);
public void renderOnSchematic(PoseStack ms, SuperRenderTypeBuffer buffer);
}

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraftforge.client.gui.ForgeIngameGui;
public abstract class PlacementToolBase extends SchematicToolBase {
@ -23,8 +23,8 @@ public abstract class PlacementToolBase extends SchematicToolBase {
}
@Override
public void renderOverlay(PoseStack ms, MultiBufferSource buffer) {
super.renderOverlay(ms, buffer);
public void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {
super.renderOverlay(gui, poseStack, partialTicks, width, height);
}
@Override

View file

@ -18,13 +18,13 @@ import com.simibubi.create.foundation.utility.outliner.AABBOutline;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult.Type;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.gui.ForgeIngameGui;
public abstract class SchematicToolBase implements ISchematicTool {
@ -124,7 +124,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer) {}
@Override
public void renderOverlay(PoseStack ms, MultiBufferSource buffer) {}
public void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {}
@Override
public void renderOnSchematic(PoseStack ms, SuperRenderTypeBuffer buffer) {

View file

@ -21,7 +21,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.tra
import com.simibubi.create.content.contraptions.components.structureMovement.train.CouplingRenderer;
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
import com.simibubi.create.content.contraptions.components.turntable.TurntableHandler;
import com.simibubi.create.content.contraptions.goggles.GoggleOverlayRenderer;
import com.simibubi.create.content.contraptions.itemAssembly.SequencedAssemblyRecipe;
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorHandler;
import com.simibubi.create.content.curiosities.armor.CopperBacktankArmorLayer;
@ -56,11 +55,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedClientWorld;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
@ -76,10 +71,8 @@ import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.client.event.EntityViewRenderEvent;
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderTooltipEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.TickEvent.RenderTickEvent;
@ -199,31 +192,6 @@ public class ClientEvents {
ms.popPose();
}
@SubscribeEvent
public static void afterRenderOverlayLayer(RenderGameOverlayEvent.PostLayer event) {
PoseStack ms = event.getMatrixStack();
BufferSource buffers = Minecraft.getInstance()
.renderBuffers()
.bufferSource();
int light = LightTexture.FULL_BRIGHT;
int overlay = OverlayTexture.NO_OVERLAY;
float pt = event.getPartialTicks();
if (event.getOverlay() == ForgeIngameGui.AIR_LEVEL_ELEMENT)
CopperBacktankArmorLayer.renderRemainingAirOverlay(ms, buffers, light, overlay, pt);
if (event.getOverlay() == ForgeIngameGui.HOTBAR_ELEMENT)
onRenderHotbar(ms, buffers, light, overlay, pt);
}
public static void onRenderHotbar(PoseStack ms, MultiBufferSource buffer, int light, int overlay,
float partialTicks) {
CreateClient.SCHEMATIC_HANDLER.renderOverlay(ms, buffer, light, overlay, partialTicks);
LinkedControllerClientHandler.renderOverlay(ms, buffer, light, overlay, partialTicks);
BlueprintOverlayRenderer.renderOverlay(ms, buffer, light, overlay, partialTicks);
GoggleOverlayRenderer.renderOverlay(ms, buffer, light, overlay, partialTicks);
ToolboxHandlerClient.renderOverlay(ms, buffer, light, overlay, partialTicks);
}
@SubscribeEvent
public static void getItemTooltipColor(RenderTooltipEvent.Color event) {
PonderTooltipHandler.handleTooltipColor(event);

View file

@ -36,6 +36,7 @@ import net.minecraft.world.level.material.FluidState;
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.OnDatapackSyncEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.TickEvent.ServerTickEvent;
@ -139,7 +140,7 @@ public class CommonEvents {
}
@SubscribeEvent
public static void registerReloadListeners(AddReloadListenerEvent event) {
public static void addReloadListeners(AddReloadListenerEvent event) {
event.addListener(RecipeFinder.LISTENER);
event.addListener(PotionMixingRecipeManager.LISTENER);
event.addListener(FluidTransferRecipes.LISTENER);
@ -147,7 +148,17 @@ public class CommonEvents {
}
@SubscribeEvent
public static void serverStopped(FMLServerStoppingEvent event) {
public static void onDatapackSync(OnDatapackSyncEvent event) {
ServerPlayer player = event.getPlayer();
if (player != null) {
PotatoProjectileTypeManager.syncTo(player);
} else {
PotatoProjectileTypeManager.syncToAll();
}
}
@SubscribeEvent
public static void serverStopping(FMLServerStoppingEvent event) {
Create.SCHEMATIC_RECEIVER.shutdown();
}

View file

@ -1,22 +0,0 @@
package com.simibubi.create.foundation.block;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.core.BlockPos;
public class BreakProgressHook {
public static void whenBreaking(ClientLevel world, LevelRenderer renderer, int playerEntityId, BlockPos pos, int progress) {
if (AllBlocks.BELT.has(world.getBlockState(pos))) {
BeltTileEntity belt = (BeltTileEntity) world.getBlockEntity(pos);
for (BlockPos beltPos : BeltBlock.getBeltChain(world, belt.getController())) {
renderer.destroyBlockProgress(beltPos.hashCode(), beltPos, progress);
}
}
}
}

View file

@ -0,0 +1,16 @@
package com.simibubi.create.foundation.block.render;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.IBlockRenderProperties;
public interface DestroyProgressRenderingHandler extends IBlockRenderProperties {
/**
* Called before the default block breaking progress overlay is rendered.
*
* @return if the default rendering should be cancelled or not
*/
boolean renderDestroyProgress(ClientLevel level, LevelRenderer renderer, int breakerId, BlockPos pos, int progress, BlockState blockState);
}

View file

@ -1,38 +1,32 @@
package com.simibubi.create.foundation.block.render;
import net.minecraft.client.renderer.texture.TextureAtlas;
import com.jozufozu.flywheel.core.StitchedSprite;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.resources.ResourceLocation;
public class SpriteShiftEntry {
protected ResourceLocation originalTextureLocation;
protected ResourceLocation targetTextureLocation;
protected TextureAtlasSprite original;
protected TextureAtlasSprite target;
protected StitchedSprite original;
protected StitchedSprite target;
public void set(ResourceLocation originalTextureLocation, ResourceLocation targetTextureLocation) {
this.originalTextureLocation = originalTextureLocation;
this.targetTextureLocation = targetTextureLocation;
original = new StitchedSprite(originalTextureLocation);
target = new StitchedSprite(targetTextureLocation);
}
public ResourceLocation getOriginalResourceLocation() {
return originalTextureLocation;
return original.getLocation();
}
public ResourceLocation getTargetResourceLocation() {
return targetTextureLocation;
return target.getLocation();
}
public TextureAtlasSprite getOriginal() {
return original;
return original.get();
}
public TextureAtlasSprite getTarget() {
return target;
return target.get();
}
protected void loadTextures(TextureAtlas atlas) {
original = atlas.getSprite(originalTextureLocation);
target = atlas.getSprite(targetTextureLocation);
}
}
}

View file

@ -1,21 +1,12 @@
package com.simibubi.create.foundation.block.render;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.simibubi.create.Create;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.InventoryMenu;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
public class SpriteShifter {
protected static final Map<String, SpriteShiftEntry> ENTRY_CACHE = new HashMap<>();
@ -35,32 +26,4 @@ public class SpriteShifter {
return get(Create.asResource(originalLocation), Create.asResource(targetLocation));
}
public static List<ResourceLocation> getAllTargetSprites() {
return ENTRY_CACHE.values().stream().map(SpriteShiftEntry::getTargetResourceLocation).collect(Collectors.toList());
}
@SubscribeEvent
public static void onTextureStitchPre(TextureStitchEvent.Pre event) {
if (!event.getMap()
.location()
.equals(InventoryMenu.BLOCK_ATLAS))
return;
getAllTargetSprites()
.forEach(event::addSprite);
}
@SubscribeEvent
public static void onTextureStitchPost(TextureStitchEvent.Post event) {
if (!event.getMap()
.location()
.equals(InventoryMenu.BLOCK_ATLAS))
return;
TextureAtlas atlas = event.getMap();
for (SpriteShiftEntry entry : ENTRY_CACHE.values()) {
entry.loadTextures(atlas);
}
}
}

View file

@ -14,8 +14,8 @@ import com.simibubi.create.foundation.config.ui.SubMenuConfigScreen;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.networking.SimplePacketBase;
import com.simibubi.create.foundation.ponder.PonderRegistry;
import com.simibubi.create.foundation.ponder.PonderUI;
import com.simibubi.create.foundation.ponder.content.PonderIndexScreen;
import com.simibubi.create.foundation.ponder.ui.PonderIndexScreen;
import com.simibubi.create.foundation.ponder.ui.PonderUI;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;

View file

@ -2,7 +2,6 @@ package com.simibubi.create.foundation.fluid;
import java.util.function.Function;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.PoseStack.Pose;

View file

@ -10,7 +10,7 @@ import com.simibubi.create.foundation.config.ui.BaseConfigScreen;
import com.simibubi.create.foundation.gui.element.BoxElement;
import com.simibubi.create.foundation.gui.element.GuiGameElement;
import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.ponder.content.PonderTagIndexScreen;
import com.simibubi.create.foundation.ponder.ui.PonderTagIndexScreen;
import com.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Lang;

View file

@ -3,7 +3,6 @@ package com.simibubi.create.foundation.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import com.simibubi.create.foundation.utility.VecHelper;
public class CustomLightingSettings implements ILightingSettings {
@ -29,7 +28,7 @@ public class CustomLightingSettings implements ILightingSettings {
light2.transform(Vector3f.YP.rotationDegrees(yRot2));
light2.transform(Vector3f.XN.rotationDegrees(xRot2));
} else {
light2 = VecHelper.ZERO_3F;
light2 = Vector3f.ZERO;
}
lightMatrix = new Matrix4f();

View file

@ -8,7 +8,7 @@ import java.util.Optional;
import javax.annotation.Nullable;
import com.simibubi.create.foundation.ponder.NavigatableSimiScreen;
import com.simibubi.create.foundation.ponder.ui.NavigatableSimiScreen;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import net.minecraft.client.Minecraft;

View file

@ -28,7 +28,6 @@ import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.world.inventory.InventoryMenu;
@ -262,8 +261,8 @@ public class GuiGameElement {
ItemRenderer renderer = Minecraft.getInstance().getItemRenderer();
BakedModel bakedModel = renderer.getModel(stack, null, null, 0);
renderer.textureManager.getTexture(TextureAtlas.LOCATION_BLOCKS).setFilter(false, false);
RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS);
renderer.textureManager.getTexture(InventoryMenu.BLOCK_ATLAS).setFilter(false, false);
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -1,27 +0,0 @@
package com.simibubi.create.foundation.mixin;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.simibubi.create.foundation.block.BreakProgressHook;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.core.BlockPos;
@Mixin(ClientLevel.class)
public class BreakProgressMixin {
@Shadow
@Final
private LevelRenderer levelRenderer; // levelRenderer
private final ClientLevel self = (ClientLevel) (Object) this;
@Inject(at = @At("HEAD"), method = "destroyBlockProgress")
private void onBreakProgress(int playerEntityId, BlockPos pos, int progress, CallbackInfo ci) {
BreakProgressHook.whenBreaking(self, this.levelRenderer, playerEntityId, pos, progress);
}
}

View file

@ -0,0 +1,36 @@
package com.simibubi.create.foundation.mixin;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.simibubi.create.foundation.block.render.DestroyProgressRenderingHandler;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.IBlockRenderProperties;
import net.minecraftforge.client.RenderProperties;
@Mixin(ClientLevel.class)
public class DestroyProgressMixin {
@Shadow
@Final
private LevelRenderer levelRenderer;
@Inject(at = @At("HEAD"), method = "destroyBlockProgress(ILnet/minecraft/core/BlockPos;I)V", cancellable = true)
private void onDestroyBlockProgress(int breakerId, BlockPos pos, int progress, CallbackInfo ci) {
ClientLevel self = (ClientLevel) (Object) this;
BlockState state = self.getBlockState(pos);
IBlockRenderProperties properties = RenderProperties.get(state);
if (properties instanceof DestroyProgressRenderingHandler handler) {
if (handler.renderDestroyProgress(self, levelRenderer, breakerId, pos, progress, state)) {
ci.cancel();
}
}
}
}

View file

@ -18,8 +18,8 @@ import net.minecraftforge.api.distmarker.OnlyIn;
@Mixin(LocalPlayer.class)
public abstract class HeavyBootsOnPlayerMixin extends AbstractClientPlayer {
public HeavyBootsOnPlayerMixin(ClientLevel p_i50991_1_, GameProfile p_i50991_2_) {
super(p_i50991_1_, p_i50991_2_);
private HeavyBootsOnPlayerMixin(ClientLevel level, GameProfile profile) {
super(level, profile);
}
@Inject(at = @At("HEAD"), method = "isUnderWater", cancellable = true)

View file

@ -1,25 +0,0 @@
package com.simibubi.create.foundation.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.simibubi.create.content.curiosities.weapons.PotatoProjectileTypeManager;
import net.minecraft.network.Connection;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.players.PlayerList;
@Mixin(PlayerList.class)
public class PlayerListMixin {
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/stats/ServerRecipeBook;sendInitialRecipeBook(Lnet/minecraft/server/level/ServerPlayer;)V", shift = At.Shift.AFTER), method = "placeNewPlayer(Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;)V")
private void afterSendRecipeBookOnPlaceNewPlayer(Connection connection, ServerPlayer player, CallbackInfo ci) {
PotatoProjectileTypeManager.syncTo(player);
}
@Inject(at = @At("TAIL"), method = "reloadResources()V")
private void onReloadResources(CallbackInfo ci) {
PotatoProjectileTypeManager.syncToAll();
}
}

View file

@ -159,11 +159,11 @@ public enum AllPackets {
private static class LoadedPacket<T extends SimplePacketBase> {
private static int index = 0;
BiConsumer<T, FriendlyByteBuf> encoder;
Function<FriendlyByteBuf, T> decoder;
BiConsumer<T, Supplier<Context>> handler;
Class<T> type;
NetworkDirection direction;
private BiConsumer<T, FriendlyByteBuf> encoder;
private Function<FriendlyByteBuf, T> decoder;
private BiConsumer<T, Supplier<Context>> handler;
private Class<T> type;
private NetworkDirection direction;
private LoadedPacket(Class<T> type, Function<FriendlyByteBuf, T> factory, NetworkDirection direction) {
encoder = T::write;

View file

@ -2,6 +2,8 @@ package com.simibubi.create.foundation.ponder;
import java.util.UUID;
import com.simibubi.create.foundation.ponder.element.PonderElement;
public class ElementLink<T extends PonderElement> {
private Class<T> elementClass;

View file

@ -1,12 +1,10 @@
package com.simibubi.create.foundation.ponder.content;
package com.simibubi.create.foundation.ponder;
import javax.annotation.Nonnull;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.gui.element.ScreenElement;
import com.simibubi.create.foundation.ponder.PonderLocalization;
import com.simibubi.create.foundation.ponder.PonderRegistry;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.resources.ResourceLocation;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.foundation.ponder.content;
package com.simibubi.create.foundation.ponder;
import java.util.ArrayList;
import java.util.Collections;
@ -10,7 +10,6 @@ import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.simibubi.create.foundation.ponder.PonderStoryBoardEntry;
import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.resources.ResourceLocation;

View file

@ -7,10 +7,10 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.ponder.content.PonderIndex;
import com.simibubi.create.foundation.ponder.content.PonderTag;
import com.simibubi.create.foundation.ponder.content.PonderTagIndexScreen;
import com.simibubi.create.foundation.ponder.content.PonderTagScreen;
import com.simibubi.create.foundation.ponder.content.SharedText;
import com.simibubi.create.foundation.ponder.ui.PonderTagIndexScreen;
import com.simibubi.create.foundation.ponder.ui.PonderTagScreen;
import com.simibubi.create.foundation.ponder.ui.PonderUI;
import com.simibubi.create.foundation.utility.Couple;
import com.tterrag.registrate.AbstractRegistrate;

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