mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Merge branch 'refs/heads/mc1.20.1/feature-dev' into mc1.21.1/dev
# Conflicts: # src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/ItemAttribute.java # src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java # src/main/java/com/simibubi/create/foundation/mixin/ContraptionDriverInteractMixin.java # src/main/java/com/simibubi/create/foundation/mixin/EntityMixin.java # src/main/java/com/simibubi/create/foundation/mixin/accessor/LevelRendererAccessor.java # src/main/java/com/simibubi/create/foundation/mixin/client/CameraMixin.java # src/main/java/com/simibubi/create/foundation/mixin/client/EntityContraptionInteractionMixin.java # src/main/java/com/simibubi/create/foundation/mixin/client/HumanoidArmorLayerMixin.java # src/main/java/com/simibubi/create/foundation/mixin/client/LevelRendererMixin.java # src/main/java/com/simibubi/create/foundation/mixin/client/ModelDataRefreshMixin.java # src/main/java/com/simibubi/create/foundation/networking/BlockEntityConfigurationPacket.java # src/main/resources/create.mixins.json
This commit is contained in:
commit
f66d29e34c
34 changed files with 172 additions and 137 deletions
|
@ -385,8 +385,7 @@ public class AllBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new)
|
public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
.properties(p -> p.mapColor(MapColor.METAL)
|
.properties(p -> p.mapColor(MapColor.METAL).forceSolidOff())
|
||||||
.forceSolidOn())
|
|
||||||
.transform(BlockStressDefaults.setNoImpact())
|
.transform(BlockStressDefaults.setNoImpact())
|
||||||
.transform(pickaxeOnly())
|
.transform(pickaxeOnly())
|
||||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||||
|
@ -897,7 +896,7 @@ public class AllBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<FluidPipeBlock> FLUID_PIPE = REGISTRATE.block("fluid_pipe", FluidPipeBlock::new)
|
public static final BlockEntry<FluidPipeBlock> FLUID_PIPE = REGISTRATE.block("fluid_pipe", FluidPipeBlock::new)
|
||||||
.initialProperties(SharedProperties::copperMetal)
|
.initialProperties(SharedProperties::copperMetal)
|
||||||
.properties(p -> p.forceSolidOn())
|
.properties(p -> p.forceSolidOff())
|
||||||
.transform(pickaxeOnly())
|
.transform(pickaxeOnly())
|
||||||
.blockstate(BlockStateGen.pipe())
|
.blockstate(BlockStateGen.pipe())
|
||||||
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::withoutAO))
|
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::withoutAO))
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.compat.computercraft.implementation.peripherals;
|
package com.simibubi.create.compat.computercraft.implementation.peripherals;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -8,7 +10,11 @@ import com.simibubi.create.content.redstone.displayLink.DisplayLinkBlockEntity;
|
||||||
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
|
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
|
||||||
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
|
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
|
||||||
|
|
||||||
|
import dan200.computercraft.api.lua.IArguments;
|
||||||
|
import dan200.computercraft.api.lua.LuaException;
|
||||||
import dan200.computercraft.api.lua.LuaFunction;
|
import dan200.computercraft.api.lua.LuaFunction;
|
||||||
|
import dan200.computercraft.api.lua.LuaValues;
|
||||||
|
import dan200.computercraft.api.lua.ObjectLuaTable;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
|
@ -53,6 +59,28 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final void write(String text) {
|
public final void write(String text) {
|
||||||
|
writeImpl(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
@LuaFunction
|
||||||
|
public final void writeBytes(IArguments args) throws LuaException {
|
||||||
|
Object data = args.get(0);
|
||||||
|
byte[] bytes;
|
||||||
|
if (data instanceof String str) {
|
||||||
|
bytes = str.getBytes(StandardCharsets.US_ASCII);
|
||||||
|
} else if (data instanceof Map<?, ?> map) {
|
||||||
|
ObjectLuaTable table = new ObjectLuaTable(map);
|
||||||
|
bytes = new byte[table.length()];
|
||||||
|
for (int i = 0; i < bytes.length; i++) {
|
||||||
|
bytes[i] = (byte) (table.getInt(i + 1) & 0xff);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw LuaValues.badArgumentOf(args, 0, "string or table");
|
||||||
|
}
|
||||||
|
writeImpl(new String(bytes, StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void writeImpl(String text) {
|
||||||
ListTag tag = blockEntity.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
|
ListTag tag = blockEntity.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
|
||||||
|
|
||||||
int x = cursorX.get();
|
int x = cursorX.get();
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.simibubi.create.foundation.item.CustomUseEffectsItem;
|
||||||
import com.simibubi.create.foundation.item.render.SimpleCustomRenderer;
|
import com.simibubi.create.foundation.item.render.SimpleCustomRenderer;
|
||||||
import com.simibubi.create.foundation.mixin.accessor.LivingEntityAccessor;
|
import com.simibubi.create.foundation.mixin.accessor.LivingEntityAccessor;
|
||||||
|
|
||||||
|
import net.createmod.catnip.data.TriState;
|
||||||
import net.createmod.catnip.math.VecHelper;
|
import net.createmod.catnip.math.VecHelper;
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -200,9 +201,9 @@ public class SandPaperItem extends Item implements CustomUseEffectsItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean shouldTriggerUseEffects(ItemStack stack, LivingEntity entity) {
|
public TriState shouldTriggerUseEffects(ItemStack stack, LivingEntity entity) {
|
||||||
// Trigger every tick so that we have more fine grain control over the animation
|
// Trigger every tick so that we have more fine grain control over the animation
|
||||||
return true;
|
return TriState.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -128,6 +128,7 @@ public class SpoutBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
|
||||||
// Process finished
|
// Process finished
|
||||||
ItemStack out = FillingBySpout.fillItem(level, requiredAmountForItem, transported.stack, fluid);
|
ItemStack out = FillingBySpout.fillItem(level, requiredAmountForItem, transported.stack, fluid);
|
||||||
if (!out.isEmpty()) {
|
if (!out.isEmpty()) {
|
||||||
|
transported.clearFanProcessingData();
|
||||||
List<TransportedItemStack> outList = new ArrayList<>();
|
List<TransportedItemStack> outList = new ArrayList<>();
|
||||||
TransportedItemStack held = null;
|
TransportedItemStack held = null;
|
||||||
TransportedItemStack result = transported.copy();
|
TransportedItemStack result = transported.copy();
|
||||||
|
|
|
@ -2,13 +2,16 @@ package com.simibubi.create.content.kinetics.belt.transport;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllRegistries;
|
||||||
import com.simibubi.create.content.kinetics.belt.BeltHelper;
|
import com.simibubi.create.content.kinetics.belt.BeltHelper;
|
||||||
|
import com.simibubi.create.content.kinetics.fan.processing.AllFanProcessingTypes;
|
||||||
import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType;
|
import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType;
|
||||||
import com.simibubi.create.content.logistics.box.PackageItem;
|
import com.simibubi.create.content.logistics.box.PackageItem;
|
||||||
|
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
public class TransportedItemStack implements Comparable<TransportedItemStack> {
|
public class TransportedItemStack implements Comparable<TransportedItemStack> {
|
||||||
|
@ -78,6 +81,16 @@ public class TransportedItemStack implements Comparable<TransportedItemStack> {
|
||||||
nbt.putInt("InSegment", insertedAt);
|
nbt.putInt("InSegment", insertedAt);
|
||||||
nbt.putInt("Angle", angle);
|
nbt.putInt("Angle", angle);
|
||||||
nbt.putInt("InDirection", insertedFrom.get3DDataValue());
|
nbt.putInt("InDirection", insertedFrom.get3DDataValue());
|
||||||
|
|
||||||
|
if (processedBy != null && processedBy != AllFanProcessingTypes.NONE) {
|
||||||
|
ResourceLocation key = AllRegistries.FAN_PROCESSING_TYPES.getKey(processedBy);
|
||||||
|
if (key == null)
|
||||||
|
throw new IllegalArgumentException("Could not get id for FanProcessingType " + processedBy + "!");
|
||||||
|
|
||||||
|
nbt.putString("FanProcessingType", key.toString());
|
||||||
|
nbt.putInt("FanProcessingTime", processingTime);
|
||||||
|
}
|
||||||
|
|
||||||
if (locked)
|
if (locked)
|
||||||
nbt.putBoolean("Locked", locked);
|
nbt.putBoolean("Locked", locked);
|
||||||
if (lockedExternally)
|
if (lockedExternally)
|
||||||
|
@ -96,7 +109,18 @@ public class TransportedItemStack implements Comparable<TransportedItemStack> {
|
||||||
stack.insertedFrom = Direction.from3DDataValue(nbt.getInt("InDirection"));
|
stack.insertedFrom = Direction.from3DDataValue(nbt.getInt("InDirection"));
|
||||||
stack.locked = nbt.getBoolean("Locked");
|
stack.locked = nbt.getBoolean("Locked");
|
||||||
stack.lockedExternally = nbt.getBoolean("LockedExternally");
|
stack.lockedExternally = nbt.getBoolean("LockedExternally");
|
||||||
|
|
||||||
|
if (nbt.contains("FanProcessingType")) {
|
||||||
|
stack.processedBy = AllFanProcessingTypes.parseLegacy(nbt.getString("FanProcessingType"));
|
||||||
|
stack.processingTime = nbt.getInt("FanProcessingTime");
|
||||||
|
}
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearFanProcessingData() {
|
||||||
|
processedBy = null;
|
||||||
|
processingTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,8 @@ public class BeltDeployerCallbacks {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
blockEntity.award(AllAdvancements.DEPLOYER);
|
blockEntity.award(AllAdvancements.DEPLOYER);
|
||||||
|
|
||||||
|
transported.clearFanProcessingData();
|
||||||
|
|
||||||
TransportedItemStack left = transported.copy();
|
TransportedItemStack left = transported.copy();
|
||||||
blockEntity.player.spawnedItemEffects = transported.stack.copy();
|
blockEntity.player.spawnedItemEffects = transported.stack.copy();
|
||||||
|
|
|
@ -49,6 +49,8 @@ public class BeltPressingCallbacks {
|
||||||
|
|
||||||
boolean bulk = behaviour.specifics.canProcessInBulk() || transported.stack.getCount() == 1;
|
boolean bulk = behaviour.specifics.canProcessInBulk() || transported.stack.getCount() == 1;
|
||||||
|
|
||||||
|
transported.clearFanProcessingData();
|
||||||
|
|
||||||
List<TransportedItemStack> collect = results.stream()
|
List<TransportedItemStack> collect = results.stream()
|
||||||
.map(stack -> {
|
.map(stack -> {
|
||||||
TransportedItemStack copy = transported.copy();
|
TransportedItemStack copy = transported.copy();
|
||||||
|
|
|
@ -13,9 +13,7 @@ import com.simibubi.create.foundation.utility.CreateLang;
|
||||||
import net.createmod.catnip.codecs.CatnipCodecUtils;
|
import net.createmod.catnip.codecs.CatnipCodecUtils;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtOps;
|
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.resources.RegistryOps;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
|
@ -33,7 +31,7 @@ public interface ItemAttribute {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
static ItemAttribute loadStatic(CompoundTag nbt, HolderLookup.Provider registries) {
|
static ItemAttribute loadStatic(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||||
return CODEC.decode(RegistryOps.create(NbtOps.INSTANCE, registries), nbt.get("attribute")).getOrThrow().getFirst();
|
return CatnipCodecUtils.decode(CODEC, registries, nbt.get("attribute")).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<ItemAttribute> getAllAttributes(ItemStack stack, Level level) {
|
static List<ItemAttribute> getAllAttributes(ItemStack stack, Level level) {
|
||||||
|
|
|
@ -16,17 +16,18 @@ import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringB
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour;
|
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour;
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment;
|
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment;
|
||||||
import com.simibubi.create.foundation.fluid.FluidIngredient;
|
import com.simibubi.create.foundation.fluid.FluidIngredient;
|
||||||
import com.simibubi.create.foundation.item.SmartInventory;
|
|
||||||
import com.simibubi.create.foundation.recipe.DummyCraftingContainer;
|
import com.simibubi.create.foundation.recipe.DummyCraftingContainer;
|
||||||
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
|
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
|
||||||
|
|
||||||
import net.createmod.catnip.data.Iterate;
|
import net.createmod.catnip.data.Iterate;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.CraftingInput;
|
||||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeInput;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||||
|
@ -34,7 +35,7 @@ import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
|
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
|
||||||
import net.neoforged.neoforge.items.IItemHandler;
|
import net.neoforged.neoforge.items.IItemHandler;
|
||||||
|
|
||||||
public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
public class BasinRecipe extends ProcessingRecipe<RecipeInput> {
|
||||||
|
|
||||||
public static boolean match(BasinBlockEntity basin, Recipe<?> recipe) {
|
public static boolean match(BasinBlockEntity basin, Recipe<?> recipe) {
|
||||||
FilteringBehaviour filter = basin.getFilter();
|
FilteringBehaviour filter = basin.getFilter();
|
||||||
|
@ -146,13 +147,16 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simulate) {
|
if (simulate) {
|
||||||
|
CraftingInput remainderInput = new DummyCraftingContainer(availableItems, extractedItemsFromSlot)
|
||||||
|
.asCraftInput();
|
||||||
|
|
||||||
if (recipe instanceof BasinRecipe basinRecipe) {
|
if (recipe instanceof BasinRecipe basinRecipe) {
|
||||||
recipeOutputItems.addAll(basinRecipe.rollResults());
|
recipeOutputItems.addAll(basinRecipe.rollResults());
|
||||||
|
|
||||||
for (FluidStack fluidStack : basinRecipe.getFluidResults())
|
for (FluidStack fluidStack : basinRecipe.getFluidResults())
|
||||||
if (!fluidStack.isEmpty())
|
if (!fluidStack.isEmpty())
|
||||||
recipeOutputFluids.add(fluidStack);
|
recipeOutputFluids.add(fluidStack);
|
||||||
for (ItemStack stack : basinRecipe.getRemainingItems(basin.getInputInventory()))
|
for (ItemStack stack : basinRecipe.getRemainingItems(remainderInput))
|
||||||
if (!stack.isEmpty())
|
if (!stack.isEmpty())
|
||||||
recipeOutputItems.add(stack);
|
recipeOutputItems.add(stack);
|
||||||
|
|
||||||
|
@ -161,8 +165,7 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
||||||
.registryAccess()));
|
.registryAccess()));
|
||||||
|
|
||||||
if (recipe instanceof CraftingRecipe craftingRecipe) {
|
if (recipe instanceof CraftingRecipe craftingRecipe) {
|
||||||
for (ItemStack stack : craftingRecipe
|
for (ItemStack stack : craftingRecipe.getRemainingItems(remainderInput))
|
||||||
.getRemainingItems(new DummyCraftingContainer(availableItems, extractedItemsFromSlot).asCraftInput()))
|
|
||||||
if (!stack.isEmpty())
|
if (!stack.isEmpty())
|
||||||
recipeOutputItems.add(stack);
|
recipeOutputItems.add(stack);
|
||||||
}
|
}
|
||||||
|
@ -223,7 +226,7 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(SmartInventory inv, @Nonnull Level worldIn) {
|
public boolean matches(RecipeInput input, @Nonnull Level worldIn) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.core.BlockPos;
|
||||||
|
|
||||||
public interface BlockDestructionProgressExtension {
|
public interface BlockDestructionProgressExtension {
|
||||||
@Nullable
|
@Nullable
|
||||||
Set<BlockPos> getExtraPositions();
|
Set<BlockPos> create$getExtraPositions();
|
||||||
|
|
||||||
void setExtraPositions(@Nullable Set<BlockPos> positions);
|
void create$setExtraPositions(@Nullable Set<BlockPos> positions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ValueBoxRenderer {
|
||||||
float zOffset = (!blockItem ? -.15f : 0) + customZOffset(filter.getItem());
|
float zOffset = (!blockItem ? -.15f : 0) + customZOffset(filter.getItem());
|
||||||
ms.scale(scale, scale, scale);
|
ms.scale(scale, scale, scale);
|
||||||
ms.translate(0, 0, zOffset);
|
ms.translate(0, 0, zOffset);
|
||||||
itemRenderer.renderStatic(filter, ItemDisplayContext.FIXED, light, overlay, ms, buffer, mc.level, 0);
|
itemRenderer.render(filter, ItemDisplayContext.FIXED, false, ms, buffer, light, overlay, modelWithOverrides);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderFlatItemIntoValueBox(ItemStack filter, PoseStack ms, MultiBufferSource buffer, int light,
|
public static void renderFlatItemIntoValueBox(ItemStack filter, PoseStack ms, MultiBufferSource buffer, int light,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.AllTags.AllItemTags;
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.SidedFilteringBehaviour;
|
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.SidedFilteringBehaviour;
|
||||||
|
import com.simibubi.create.foundation.utility.AdventureUtil;
|
||||||
|
|
||||||
import net.createmod.catnip.platform.CatnipServices;
|
import net.createmod.catnip.platform.CatnipServices;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -93,7 +94,6 @@ public class ValueSettingsInputHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canInteract(Player player) {
|
public static boolean canInteract(Player player) {
|
||||||
return player != null && !player.isSpectator() && !player.isShiftKeyDown();
|
return player != null && !player.isSpectator() && !player.isShiftKeyDown() && !AdventureUtil.isAdventure(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class CountedItemStackList {
|
||||||
|
|
||||||
public CountedItemStackList(IItemHandler inventory, FilteringBehaviour filteringBehaviour) {
|
public CountedItemStackList(IItemHandler inventory, FilteringBehaviour filteringBehaviour) {
|
||||||
for (int slot = 0; slot < inventory.getSlots(); slot++) {
|
for (int slot = 0; slot < inventory.getSlots(); slot++) {
|
||||||
ItemStack extractItem = inventory.extractItem(slot, inventory.getSlotLimit(slot), true);
|
ItemStack extractItem = inventory.getStackInSlot(slot);
|
||||||
if (filteringBehaviour.test(extractItem))
|
if (filteringBehaviour.test(extractItem))
|
||||||
add(extractItem);
|
add(extractItem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.simibubi.create.foundation.item;
|
package com.simibubi.create.foundation.item;
|
||||||
|
|
||||||
|
import net.createmod.catnip.data.TriState;
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -8,20 +9,20 @@ public interface CustomUseEffectsItem {
|
||||||
/**
|
/**
|
||||||
* Called to determine if use effects should be applied for this item.
|
* Called to determine if use effects should be applied for this item.
|
||||||
*
|
*
|
||||||
* @param stack The ItemStack being used.
|
* @param stack The ItemStack being used.
|
||||||
* @param entity The LivingEntity using the item.
|
* @param entity The LivingEntity using the item.
|
||||||
* @return null for default behavior, or boolean to override default behavior
|
* @return {@link TriState#DEFAULT} for default behavior, or {@link TriState#TRUE}/{@link TriState#FALSE} to override default behavior
|
||||||
*/
|
*/
|
||||||
default Boolean shouldTriggerUseEffects(ItemStack stack, LivingEntity entity) {
|
default TriState shouldTriggerUseEffects(ItemStack stack, LivingEntity entity) {
|
||||||
return null;
|
return TriState.DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when use effects should be applied for this item.
|
* Called when use effects should be applied for this item.
|
||||||
*
|
*
|
||||||
* @param stack The ItemStack being used.
|
* @param stack The ItemStack being used.
|
||||||
* @param entity The LivingEntity using the item.
|
* @param entity The LivingEntity using the item.
|
||||||
* @param count The amount of times effects should be applied. Can safely be ignored.
|
* @param count The amount of times effects should be applied. Can safely be ignored.
|
||||||
* @param random The LivingEntity's RandomSource.
|
* @param random The LivingEntity's RandomSource.
|
||||||
* @return if the default behavior should be cancelled or not
|
* @return if the default behavior should be cancelled or not
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.simibubi.create.foundation.mixin;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
|
||||||
import org.spongepowered.asm.mixin.Intrinsic;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
|
|
||||||
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.neoforged.neoforge.common.extensions.IEntityExtension;
|
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
|
||||||
@Implements(@Interface(iface = IEntityExtension.class, prefix = "iForgeEntity$"))
|
|
||||||
public abstract class ContraptionDriverInteractMixin {
|
|
||||||
@Shadow
|
|
||||||
public abstract Entity getRootVehicle();
|
|
||||||
|
|
||||||
@Intrinsic
|
|
||||||
public boolean iForgeEntity$canRiderInteract() {
|
|
||||||
return getRootVehicle() instanceof AbstractContraptionEntity;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.item.CustomUseEffectsItem;
|
import com.simibubi.create.foundation.item.CustomUseEffectsItem;
|
||||||
|
|
||||||
|
import net.createmod.catnip.data.TriState;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
@ -30,9 +31,9 @@ public abstract class CustomItemUseEffectsMixin extends Entity {
|
||||||
ItemStack using = getUseItem();
|
ItemStack using = getUseItem();
|
||||||
Item item = using.getItem();
|
Item item = using.getItem();
|
||||||
if (item instanceof CustomUseEffectsItem handler) {
|
if (item instanceof CustomUseEffectsItem handler) {
|
||||||
Boolean result = handler.shouldTriggerUseEffects(using, (LivingEntity) (Object) this);
|
TriState result = handler.shouldTriggerUseEffects(using, (LivingEntity) (Object) this);
|
||||||
if (result != null) {
|
if (result != TriState.DEFAULT) {
|
||||||
cir.setReturnValue(result);
|
cir.setReturnValue(result.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,22 +2,16 @@ package com.simibubi.create.foundation.mixin;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
import com.simibubi.create.content.equipment.armor.NetheriteDivingHandler;
|
import com.simibubi.create.content.equipment.armor.NetheriteDivingHandler;
|
||||||
|
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|
||||||
@Mixin(value = Entity.class, priority = 900)
|
@Mixin(Entity.class)
|
||||||
public class EntityMixin {
|
public class EntityMixin {
|
||||||
@Inject(method = "fireImmune()Z", at = @At("RETURN"), cancellable = true)
|
@ModifyReturnValue(method = "fireImmune()Z", at = @At("RETURN"))
|
||||||
public void create$onFireImmune(CallbackInfoReturnable<Boolean> cir) {
|
public boolean create$onFireImmune(boolean original) {
|
||||||
if (!cir.getReturnValueZ()) {
|
return ((Entity) (Object) this).getPersistentData().getBoolean(NetheriteDivingHandler.FIRE_IMMUNE_KEY) || original;
|
||||||
Entity self = (Entity) (Object) this;
|
|
||||||
boolean immune = self.getPersistentData().getBoolean(NetheriteDivingHandler.FIRE_IMMUNE_KEY);
|
|
||||||
if (immune)
|
|
||||||
cir.setReturnValue(immune);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.simibubi.create.foundation.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
|
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
|
||||||
|
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
||||||
|
|
||||||
|
@Mixin(ProjectileUtil.class)
|
||||||
|
public class ProjectileUtilMixin {
|
||||||
|
@WrapOperation(method = "getEntityHitResult(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/AABB;Ljava/util/function/Predicate;D)Lnet/minecraft/world/phys/EntityHitResult;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;canRiderInteract()Z"))
|
||||||
|
private static boolean create$interactWithEntitiesOnContraptions(Entity instance, Operation<Boolean> original) {
|
||||||
|
return original.call(instance) || instance.getRootVehicle() instanceof AbstractContraptionEntity;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,18 +1,17 @@
|
||||||
package com.simibubi.create.foundation.mixin;
|
package com.simibubi.create.foundation.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.level.block.ShulkerBoxBlock;
|
import net.minecraft.world.level.block.ShulkerBoxBlock;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
|
|
||||||
@Mixin(ShulkerBoxBlock.class)
|
@Mixin(ShulkerBoxBlock.class)
|
||||||
public class ShulkerBoxBlockMixin {
|
public class ShulkerBoxBlockMixin {
|
||||||
@ModifyExpressionValue(method = "getAnalogOutputSignal",at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getBlockEntity(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/entity/BlockEntity;"))
|
@ModifyExpressionValue(method = "getAnalogOutputSignal", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getBlockEntity(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/entity/BlockEntity;"))
|
||||||
private BlockEntity create$backportCCESuppressionFix(BlockEntity original) {
|
private BlockEntity create$backportCCESuppressionFix(BlockEntity original) {
|
||||||
return original instanceof Container ? original : null;
|
return original instanceof Container ? original : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,4 @@ public interface HumanoidArmorLayerAccessor {
|
||||||
|
|
||||||
@Invoker("setPartVisibility")
|
@Invoker("setPartVisibility")
|
||||||
void create$callSetPartVisibility(HumanoidModel<?> model, EquipmentSlot slot);
|
void create$callSetPartVisibility(HumanoidModel<?> model, EquipmentSlot slot);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package com.simibubi.create.foundation.mixin.accessor;
|
package com.simibubi.create.foundation.mixin.accessor;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.LevelRenderer;
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.culling.Frustum;
|
import net.minecraft.client.renderer.culling.Frustum;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
@Mixin(LevelRenderer.class)
|
@Mixin(LevelRenderer.class)
|
||||||
public interface LevelRendererAccessor {
|
public interface LevelRendererAccessor {
|
||||||
@Accessor("cullingFrustum")
|
@Accessor("cullingFrustum")
|
||||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.client.MouseHandler;
|
||||||
|
|
||||||
@Mixin(MouseHandler.class)
|
@Mixin(MouseHandler.class)
|
||||||
public interface MouseHandlerAccessor {
|
public interface MouseHandlerAccessor {
|
||||||
|
|
||||||
@Accessor("xpos")
|
@Accessor("xpos")
|
||||||
void create$setXPos(double xPos);
|
void create$setXPos(double xPos);
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,12 @@ public class BlockDestructionProgressMixin implements BlockDestructionProgressEx
|
||||||
private Set<BlockPos> create$extraPositions;
|
private Set<BlockPos> create$extraPositions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<BlockPos> getExtraPositions() {
|
public Set<BlockPos> create$getExtraPositions() {
|
||||||
return create$extraPositions;
|
return create$extraPositions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExtraPositions(Set<BlockPos> positions) {
|
public void create$setExtraPositions(Set<BlockPos> positions) {
|
||||||
create$extraPositions = positions;
|
create$extraPositions = positions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,10 +60,10 @@ public abstract class EntityContraptionInteractionMixin {
|
||||||
@Unique
|
@Unique
|
||||||
private Stream<AbstractContraptionEntity> create$getIntersectionContraptionsStream() {
|
private Stream<AbstractContraptionEntity> create$getIntersectionContraptionsStream() {
|
||||||
return ContraptionHandler.loadedContraptions.get(level)
|
return ContraptionHandler.loadedContraptions.get(level)
|
||||||
.values()
|
.values()
|
||||||
.stream()
|
.stream()
|
||||||
.map(Reference::get)
|
.map(Reference::get)
|
||||||
.filter(cEntity -> cEntity != null && cEntity.collidingEntities.containsKey((Entity) (Object) this));
|
.filter(cEntity -> cEntity != null && cEntity.collidingEntities.containsKey((Entity) (Object) this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
|
@ -93,7 +93,8 @@ public abstract class EntityContraptionInteractionMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
// involves block step sounds on contraptions
|
// involves block step sounds on contraptions
|
||||||
// IFNE line 661 injecting before `!blockstate.isAir(this.world, blockpos)`
|
// injecting before `!blockstate1.isAir(this.world, blockpos)`
|
||||||
|
// `if (this.moveDist > this.nextStep && !blockstate1.isAir())
|
||||||
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;isAir()Z", ordinal = 0))
|
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;isAir()Z", ordinal = 0))
|
||||||
private void create$contraptionStepSounds(MoverType mover, Vec3 movement, CallbackInfo ci) {
|
private void create$contraptionStepSounds(MoverType mover, Vec3 movement, CallbackInfo ci) {
|
||||||
Vec3 worldPos = position.add(0, -0.2, 0);
|
Vec3 worldPos = position.add(0, -0.2, 0);
|
||||||
|
|
|
@ -2,27 +2,22 @@ package com.simibubi.create.foundation.mixin.client;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.player.AbstractClientPlayer;
|
import net.minecraft.client.player.AbstractClientPlayer;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
|
|
||||||
@Mixin(LocalPlayer.class)
|
@Mixin(LocalPlayer.class)
|
||||||
public abstract class HeavyBootsOnPlayerMixin extends AbstractClientPlayer {
|
public abstract class HeavyBootsOnPlayerMixin extends AbstractClientPlayer {
|
||||||
|
|
||||||
private HeavyBootsOnPlayerMixin(ClientLevel level, GameProfile profile) {
|
private HeavyBootsOnPlayerMixin(ClientLevel level, GameProfile profile) {
|
||||||
super(level, profile);
|
super(level, profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "isUnderWater()Z", at = @At("HEAD"), cancellable = true)
|
@ModifyReturnValue(method = "isUnderWater()Z", at = @At("RETURN"))
|
||||||
public void create$noSwimmingWithHeavyBootsOn(CallbackInfoReturnable<Boolean> cir) {
|
private boolean create$noSwimmingWithHeavyBootsOn(boolean original) {
|
||||||
CompoundTag persistentData = getPersistentData();
|
return getPersistentData().contains("HeavyBoots") || original;
|
||||||
if (persistentData.contains("HeavyBoots"))
|
|
||||||
cir.setReturnValue(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.simibubi.create.foundation.mixin.client;
|
package com.simibubi.create.foundation.mixin.client;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.sugar.Local;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.simibubi.create.foundation.item.CustomRenderedArmorItem;
|
import com.simibubi.create.foundation.item.CustomRenderedArmorItem;
|
||||||
|
|
||||||
|
@ -18,7 +20,13 @@ import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
@Mixin(HumanoidArmorLayer.class)
|
@Mixin(HumanoidArmorLayer.class)
|
||||||
public class HumanoidArmorLayerMixin {
|
public class HumanoidArmorLayerMixin {
|
||||||
@Inject(method = "renderArmorPiece(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/entity/EquipmentSlot;ILnet/minecraft/client/model/HumanoidModel;FFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;getItem()Lnet/minecraft/world/item/Item;"), cancellable = true)
|
@Inject(
|
||||||
|
method = "renderArmorPiece(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/entity/EquipmentSlot;ILnet/minecraft/client/model/HumanoidModel;FFFFFF)V",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/item/ItemStack;getItem()Lnet/minecraft/world/item/Item;"),
|
||||||
|
cancellable = true
|
||||||
|
)
|
||||||
private void create$onRenderArmorPiece(PoseStack poseStack, MultiBufferSource bufferSource, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel<?> model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch, CallbackInfo ci, @Local ItemStack stack) {
|
private void create$onRenderArmorPiece(PoseStack poseStack, MultiBufferSource bufferSource, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel<?> model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch, CallbackInfo ci, @Local ItemStack stack) {
|
||||||
if (stack.getItem() instanceof CustomRenderedArmorItem renderer) {
|
if (stack.getItem() instanceof CustomRenderedArmorItem renderer) {
|
||||||
renderer.renderArmorPiece((HumanoidArmorLayer<?, ?, ?>) (Object) this, poseStack, bufferSource, entity, slot, light, model, stack);
|
renderer.renderArmorPiece((HumanoidArmorLayer<?, ?, ?>) (Object) this, poseStack, bufferSource, entity, slot, light, model, stack);
|
||||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
|
|
||||||
@Mixin(HumanoidModel.class)
|
@Mixin(HumanoidModel.class)
|
||||||
public class HumanoidModelMixin<T extends LivingEntity> {
|
public class HumanoidModelMixin<T extends LivingEntity> {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
@Final
|
@Final
|
||||||
public ModelPart body;
|
public ModelPart body;
|
||||||
|
@ -36,5 +35,4 @@ public class HumanoidModelMixin<T extends LivingEntity> {
|
||||||
|
|
||||||
PlayerSkyhookRenderer.beforeSetupAnim(player, (HumanoidModel<?>) (Object) this);
|
PlayerSkyhookRenderer.beforeSetupAnim(player, (HumanoidModel<?>) (Object) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraft.client.renderer.LevelRenderer;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.BlockDestructionProgress;
|
import net.minecraft.server.level.BlockDestructionProgress;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
import net.neoforged.neoforge.client.extensions.common.IClientBlockExtensions;
|
import net.neoforged.neoforge.client.extensions.common.IClientBlockExtensions;
|
||||||
|
|
||||||
@Mixin(LevelRenderer.class)
|
@Mixin(LevelRenderer.class)
|
||||||
|
@ -41,7 +42,7 @@ public class LevelRendererMixin {
|
||||||
Set<BlockPos> extraPositions = handler.getExtraPositions(level, pos, state, progress);
|
Set<BlockPos> extraPositions = handler.getExtraPositions(level, pos, state, progress);
|
||||||
if (extraPositions != null) {
|
if (extraPositions != null) {
|
||||||
extraPositions.remove(pos);
|
extraPositions.remove(pos);
|
||||||
((BlockDestructionProgressExtension) progressObj).setExtraPositions(extraPositions);
|
((BlockDestructionProgressExtension) progressObj).create$setExtraPositions(extraPositions);
|
||||||
for (BlockPos extraPos : extraPositions) {
|
for (BlockPos extraPos : extraPositions) {
|
||||||
destructionProgress.computeIfAbsent(extraPos.asLong(), l -> Sets.newTreeSet()).add(progressObj);
|
destructionProgress.computeIfAbsent(extraPos.asLong(), l -> Sets.newTreeSet()).add(progressObj);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +52,7 @@ public class LevelRendererMixin {
|
||||||
|
|
||||||
@Inject(method = "removeProgress(Lnet/minecraft/server/level/BlockDestructionProgress;)V", at = @At("RETURN"))
|
@Inject(method = "removeProgress(Lnet/minecraft/server/level/BlockDestructionProgress;)V", at = @At("RETURN"))
|
||||||
private void create$onRemoveProgress(BlockDestructionProgress progress, CallbackInfo ci) {
|
private void create$onRemoveProgress(BlockDestructionProgress progress, CallbackInfo ci) {
|
||||||
Set<BlockPos> extraPositions = ((BlockDestructionProgressExtension) progress).getExtraPositions();
|
Set<BlockPos> extraPositions = ((BlockDestructionProgressExtension) progress).create$getExtraPositions();
|
||||||
if (extraPositions != null) {
|
if (extraPositions != null) {
|
||||||
for (BlockPos extraPos : extraPositions) {
|
for (BlockPos extraPos : extraPositions) {
|
||||||
long l = extraPos.asLong();
|
long l = extraPos.asLong();
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package com.simibubi.create.foundation.mixin.client;
|
|
||||||
|
|
||||||
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 net.createmod.catnip.levelWrappers.SchematicLevel;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
||||||
import net.neoforged.api.distmarker.Dist;
|
|
||||||
import net.neoforged.api.distmarker.OnlyIn;
|
|
||||||
import net.neoforged.neoforge.client.model.data.ModelDataManager;
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
@Mixin(ModelDataManager.class)
|
|
||||||
public class ModelDataRefreshMixin {
|
|
||||||
/**
|
|
||||||
* Normally ModelDataManager will throw an exception if a block entity tries
|
|
||||||
* to refresh its model data from a world the client isn't currently in,
|
|
||||||
* but we need that to not happen for block entities in fake schematic
|
|
||||||
* worlds, so in those cases just do nothing instead.
|
|
||||||
*/
|
|
||||||
@Inject(method = "requestModelDataRefresh", at = @At("HEAD"), cancellable = true, remap = false)
|
|
||||||
private static void create$requestModelDataRefresh(BlockEntity be, CallbackInfo ci) {
|
|
||||||
if (be != null) {
|
|
||||||
Level world = be.getLevel();
|
|
||||||
if (world != Minecraft.getInstance().level && world instanceof SchematicLevel)
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,7 +4,6 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|
||||||
|
|
||||||
import com.simibubi.create.foundation.item.CustomArmPoseItem;
|
import com.simibubi.create.foundation.item.CustomArmPoseItem;
|
||||||
|
|
||||||
|
@ -16,8 +15,9 @@ import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
@Mixin(PlayerRenderer.class)
|
@Mixin(PlayerRenderer.class)
|
||||||
public class PlayerRendererMixin {
|
public class PlayerRendererMixin {
|
||||||
@Inject(method = "getArmPose(Lnet/minecraft/client/player/AbstractClientPlayer;Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/client/model/HumanoidModel$ArmPose;", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/player/AbstractClientPlayer;getItemInHand(Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/world/item/ItemStack;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
|
@Inject(method = "getArmPose(Lnet/minecraft/client/player/AbstractClientPlayer;Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/client/model/HumanoidModel$ArmPose;", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/player/AbstractClientPlayer;getItemInHand(Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/world/item/ItemStack;"), cancellable = true)
|
||||||
private static void create$onGetArmPose(AbstractClientPlayer player, InteractionHand hand, CallbackInfoReturnable<ArmPose> cir, ItemStack stack) {
|
private static void create$onGetArmPose(AbstractClientPlayer player, InteractionHand hand, CallbackInfoReturnable<ArmPose> cir) {
|
||||||
|
ItemStack stack = player.getItemInHand(hand);
|
||||||
if (stack.getItem() instanceof CustomArmPoseItem armPoseProvider) {
|
if (stack.getItem() instanceof CustomArmPoseItem armPoseProvider) {
|
||||||
ArmPose pose = armPoseProvider.getArmPose(stack, player, hand);
|
ArmPose pose = armPoseProvider.getArmPose(stack, player, hand);
|
||||||
if (pose != null) {
|
if (pose != null) {
|
||||||
|
@ -25,6 +25,4 @@ public class PlayerRendererMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.simibubi.create.foundation.networking;
|
||||||
import com.simibubi.create.foundation.blockEntity.SyncedBlockEntity;
|
import com.simibubi.create.foundation.blockEntity.SyncedBlockEntity;
|
||||||
|
|
||||||
import net.createmod.catnip.net.base.ServerboundPacketPayload;
|
import net.createmod.catnip.net.base.ServerboundPacketPayload;
|
||||||
|
import com.simibubi.create.foundation.utility.AdventureUtil;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
@ -19,7 +21,7 @@ public abstract class BlockEntityConfigurationPacket<BE extends SyncedBlockEntit
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void handle(ServerPlayer player) {
|
public void handle(ServerPlayer player) {
|
||||||
if (player == null)
|
if (player == null || player.isSpectator() || AdventureUtil.isAdventure(player))
|
||||||
return;
|
return;
|
||||||
Level world = player.level();
|
Level world = player.level();
|
||||||
if (!world.isLoaded(this.pos))
|
if (!world.isLoaded(this.pos))
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.simibubi.create.foundation.utility;
|
||||||
|
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class AdventureUtil {
|
||||||
|
public static boolean isAdventure(@Nullable Player player) {
|
||||||
|
return player != null && !player.mayBuild() && !player.isSpectator();
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,9 +6,12 @@ import com.simibubi.create.AllBlockEntityTypes;
|
||||||
|
|
||||||
import net.createmod.catnip.nbt.NBTHelper;
|
import net.createmod.catnip.nbt.NBTHelper;
|
||||||
import net.createmod.catnip.nbt.NBTProcessors;
|
import net.createmod.catnip.nbt.NBTProcessors;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
|
|
||||||
public class CreateNBTProcessors {
|
public class CreateNBTProcessors {
|
||||||
|
@ -27,6 +30,11 @@ public class CreateNBTProcessors {
|
||||||
return data;
|
return data;
|
||||||
CompoundTag book = data.getCompound("Book");
|
CompoundTag book = data.getCompound("Book");
|
||||||
|
|
||||||
|
// Writable books can't have click events, so they're safe to keep
|
||||||
|
ResourceLocation writableBookResource = BuiltInRegistries.ITEM.getKey(Items.WRITABLE_BOOK);
|
||||||
|
if (writableBookResource != BuiltInRegistries.ITEM.getDefaultKey() && book.getString("id").equals(writableBookResource.toString()))
|
||||||
|
return data;
|
||||||
|
|
||||||
if (!book.contains("tag", Tag.TAG_COMPOUND))
|
if (!book.contains("tag", Tag.TAG_COMPOUND))
|
||||||
return data;
|
return data;
|
||||||
CompoundTag tag = book.getCompound("tag");
|
CompoundTag tag = book.getCompound("tag");
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ArmorTrimMixin",
|
"ArmorTrimMixin",
|
||||||
"BlockItemMixin",
|
"BlockItemMixin",
|
||||||
"ContraptionDriverInteractMixin",
|
|
||||||
"CustomItemUseEffectsMixin",
|
"CustomItemUseEffectsMixin",
|
||||||
"EnchantedCountIncreaseFunctionMixin",
|
"EnchantedCountIncreaseFunctionMixin",
|
||||||
"EntityMixin",
|
"EntityMixin",
|
||||||
|
@ -17,6 +16,7 @@
|
||||||
"MapItemSavedDataMixin",
|
"MapItemSavedDataMixin",
|
||||||
"MobMixin",
|
"MobMixin",
|
||||||
"PlayerMixin",
|
"PlayerMixin",
|
||||||
|
"ProjectileUtilMixin",
|
||||||
"ShulkerBoxBlockMixin",
|
"ShulkerBoxBlockMixin",
|
||||||
"SmithingMenuMixin",
|
"SmithingMenuMixin",
|
||||||
"SmithingTrimRecipeMixin",
|
"SmithingTrimRecipeMixin",
|
||||||
|
|
Loading…
Add table
Reference in a new issue