mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Breaking the cycle
- Fix a bunch of FIXME's and TODO's around the place
This commit is contained in:
parent
ba90f5405b
commit
4e7016f987
29 changed files with 66 additions and 242 deletions
|
@ -16,6 +16,7 @@ import net.minecraft.world.entity.Pose;
|
|||
import net.minecraft.world.entity.ai.goal.WrappedGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.TargetGoal;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.event.entity.EntityEvent;
|
||||
|
@ -48,7 +49,6 @@ public class CardboardArmorHandler {
|
|||
event.modifyVisibility(0);
|
||||
}
|
||||
|
||||
// FIXME 1.21: should this be pre or post?
|
||||
@SubscribeEvent
|
||||
public static void mobsMayLoseTargetWhenItIsWearingCardboard(EntityTickEvent.Pre event) {
|
||||
if (!(event.getEntity() instanceof LivingEntity entity))
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.simibubi.create.content.equipment.armor;
|
||||
|
||||
import net.createmod.catnip.nbt.NBTHelper;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
|
@ -43,7 +42,6 @@ public class DivingBootsItem extends BaseArmorItem {
|
|||
return stack;
|
||||
}
|
||||
|
||||
// FIXME 1.21: should this be pre or post?
|
||||
@SubscribeEvent
|
||||
public static void accelerateDescentUnderwater(EntityTickEvent.Pre event) {
|
||||
if (!(event.getEntity() instanceof LivingEntity entity))
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.equipment.armor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
|
@ -18,13 +20,11 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.event.tick.EntityTickEvent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@EventBusSubscriber
|
||||
public class DivingHelmetItem extends BaseArmorItem {
|
||||
public static final EquipmentSlot SLOT = EquipmentSlot.HEAD;
|
||||
|
@ -64,7 +64,6 @@ public class DivingHelmetItem extends BaseArmorItem {
|
|||
return stack;
|
||||
}
|
||||
|
||||
// FIXME 1.21: should this be pre or post?
|
||||
@SubscribeEvent
|
||||
public static void breatheUnderwater(EntityTickEvent.Pre event) {
|
||||
if (!(event.getEntity() instanceof LivingEntity entity))
|
||||
|
|
|
@ -5,13 +5,6 @@ import java.util.Optional;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.simibubi.create.AllEnchantments;
|
||||
|
@ -34,6 +27,10 @@ import net.minecraft.client.player.AbstractClientPlayer;
|
|||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
@ -232,7 +229,6 @@ public class PotatoCannonItem extends ProjectileWeaponItem implements CustomArmP
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public void appendHoverText(ItemStack stack, TooltipContext context, List<Component> tooltip, TooltipFlag flag) {
|
||||
HolderLookup.Provider registries = context.registries();
|
||||
// FIXME 1.21: checkover
|
||||
if (registries != null) {
|
||||
HolderLookup.RegistryLookup<Enchantment> enchantLookup = registries.lookupOrThrow(Registries.ENCHANTMENT);
|
||||
int power = stack.getEnchantmentLevel(enchantLookup.get(Enchantments.POWER).orElseThrow().getDelegate());
|
||||
|
|
|
@ -28,9 +28,9 @@ import com.simibubi.create.foundation.utility.CreateLang;
|
|||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||
|
||||
import dev.engine_room.flywheel.lib.visualization.VisualizationHelper;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.createmod.catnip.lang.FontHelper.Palette;
|
||||
import net.createmod.catnip.nbt.NBTHelper;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -282,7 +282,7 @@ public class KineticBlockEntity extends SmartBlockEntity implements IHaveGoggleI
|
|||
}
|
||||
|
||||
public float getSpeed() {
|
||||
if (overStressed)
|
||||
if (overStressed || level.tickRateManager().isFrozen())
|
||||
return 0;
|
||||
return getTheoreticalSpeed();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.function.Consumer;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.simibubi.create.AllDataComponents;
|
||||
import com.simibubi.create.api.contraption.transformable.TransformableBlockEntity;
|
||||
import com.simibubi.create.content.contraptions.StructureTransform;
|
||||
import com.simibubi.create.content.kinetics.base.IRotate;
|
||||
|
@ -752,8 +751,6 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
|
|||
|
||||
if (!simulate) {
|
||||
int remainingItems = count - Math.min(cost - found, count);
|
||||
if (i == inv.selected) // TODO 1.21: Check if the BlockEntityTag component also needs to be removed
|
||||
stackInSlot.remove(AllDataComponents.CLICK_TO_LINK_DATA);
|
||||
ItemStack newItem = stackInSlot.copyWithCount(remainingItems);
|
||||
if (offhand)
|
||||
player.setItemInHand(InteractionHand.OFF_HAND, newItem);
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.simibubi.create.AllDamageTypes;
|
|||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.events.custom.EntityLootEnchantmentLevelEvent;
|
||||
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -58,17 +57,6 @@ public class CrushingWheelBlockEntity extends KineticBlockEntity {
|
|||
fixControllers();
|
||||
}
|
||||
|
||||
// This increases the drops when dropCustomDeathLoot is called, and LootingEnchantFunctionMixin increases the drops
|
||||
// defined in the entity loot table
|
||||
@SubscribeEvent
|
||||
public static void crushingIsFortunate(EntityLootEnchantmentLevelEvent event) {
|
||||
DamageSource damageSource = event.getDamageSource();
|
||||
if (damageSource == null || !damageSource.is(AllDamageTypes.CRUSH))
|
||||
return;
|
||||
// TODO 1.21: check if this works now
|
||||
event.setLevel(2);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void handleCrushedMobDrops(LivingDropsEvent event) {
|
||||
DamageSource damageSource = event.getSource();
|
||||
|
|
|
@ -130,7 +130,6 @@ public class DeployerHandler {
|
|||
applyAttributes(player, true);
|
||||
}
|
||||
|
||||
// TODO 1.21: - Test
|
||||
private static void applyAttributes(Player player, boolean remove) {
|
||||
player.getMainHandItem().getAttributeModifiers().forEach(EquipmentSlot.MAINHAND, (attributeHolder, attributeModifier) -> {
|
||||
AttributeInstance instance = player.getAttributes().getInstance(attributeHolder);
|
||||
|
|
|
@ -32,9 +32,9 @@ import com.simibubi.create.foundation.virtualWorld.VirtualRenderWorld;
|
|||
|
||||
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
|
||||
import dev.engine_room.flywheel.api.visualization.VisualizationManager;
|
||||
import net.createmod.catnip.nbt.NBTHelper;
|
||||
import net.createmod.catnip.math.VecHelper;
|
||||
import net.createmod.catnip.levelWrappers.SchematicLevel;
|
||||
import net.createmod.catnip.math.VecHelper;
|
||||
import net.createmod.catnip.nbt.NBTHelper;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -50,6 +50,7 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import net.neoforged.neoforge.common.util.BlockSnapshot;
|
||||
import net.neoforged.neoforge.event.EventHooks;
|
||||
import net.neoforged.neoforge.items.IItemHandler;
|
||||
|
@ -120,7 +121,6 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
|
|||
|
||||
protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player,
|
||||
Level world, ItemStack filter) {
|
||||
// FIXME 1.21: checkover
|
||||
if (!filter.has(AllDataComponents.SCHEMATIC_ANCHOR))
|
||||
return;
|
||||
if (!world.getBlockState(pos)
|
||||
|
|
|
@ -509,9 +509,6 @@ public class SawBlockEntity extends BlockBreakingKineticBlockEntity {
|
|||
Block block = stateToBreak.getBlock();
|
||||
if (block instanceof BambooStalkBlock)
|
||||
return true;
|
||||
// FIXME 1.21: neoforge needs to do something for this
|
||||
//if (block instanceof StemGrownBlock)
|
||||
// return true;
|
||||
if (block.equals(Blocks.PUMPKIN) || block.equals(Blocks.MELON))
|
||||
return true;
|
||||
if (block instanceof CactusBlock)
|
||||
|
|
|
@ -11,9 +11,9 @@ import com.simibubi.create.AllEntityTypes;
|
|||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.content.logistics.chute.ChuteBlock;
|
||||
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.createmod.catnip.math.VecHelper;
|
||||
import net.createmod.catnip.math.AngleHelper;
|
||||
import net.createmod.catnip.math.VecHelper;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.createmod.ponder.api.level.PonderLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -201,15 +201,6 @@ public class PackageEntity extends LivingEntity implements IEntityWithComplexSpa
|
|||
return EntityDimensions.fixed(PackageItem.getWidth(box), PackageItem.getHeight(box));
|
||||
}
|
||||
|
||||
// TODO - Test if this is still needed
|
||||
// public static PackageEntity spawn(SpawnEntity spawnEntity, Level world) {
|
||||
// PackageEntity packageEntity =
|
||||
// new PackageEntity(world, spawnEntity.getPosX(), spawnEntity.getPosY(), spawnEntity.getPosZ());
|
||||
// packageEntity.setDeltaMovement(spawnEntity.getVelX(), spawnEntity.getVelY(), spawnEntity.getVelZ());
|
||||
// packageEntity.clientPosition = packageEntity.position();
|
||||
// return packageEntity;
|
||||
// }
|
||||
|
||||
public ItemStack getBox() {
|
||||
return box;
|
||||
}
|
||||
|
|
|
@ -199,6 +199,7 @@ public class FilterItem extends Item implements MenuProvider, SupportsItemCopyin
|
|||
if (!stack.has(AllDataComponents.FILTER_ITEMS))
|
||||
return newInv;
|
||||
|
||||
//noinspection DataFlowIssue - It's fine:tm: we check if it has the component before doing this
|
||||
ItemHelper.fillItemStackHandler(stack.get(AllDataComponents.FILTER_ITEMS), newInv);
|
||||
|
||||
return newInv;
|
||||
|
@ -218,7 +219,6 @@ public class FilterItem extends Item implements MenuProvider, SupportsItemCopyin
|
|||
return ItemHelper.sameItem(filter, stack);
|
||||
}
|
||||
|
||||
// TODO - Checkover
|
||||
public static boolean doPackagesHaveSameData(@NotNull ItemStack a, @NotNull ItemStack b) {
|
||||
if (a.isEmpty())
|
||||
return false;
|
||||
|
|
|
@ -53,7 +53,6 @@ public class AllItemAttributeTypes {
|
|||
DAMAGED = singleton("damaged", ItemStack::isDamaged),
|
||||
BADLY_DAMAGED = singleton("badly_damaged", s -> s.isDamaged() && (float) s.getDamageValue() / s.getMaxDamage() > 3 / 4f),
|
||||
NOT_STACKABLE = singleton("not_stackable", ((Predicate<ItemStack>) ItemStack::isStackable).negate()),
|
||||
// TODO - Test this
|
||||
EQUIPABLE = singleton("equipable", s -> {
|
||||
Equipable equipable = Equipable.get(s);
|
||||
EquipmentSlot.Type type = equipable != null ? equipable.getEquipmentSlot().getType() : EquipmentSlot.MAINHAND.getType();
|
||||
|
|
|
@ -8,8 +8,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.core.HolderLookup;
|
||||
|
||||
import org.apache.commons.lang3.mutable.MutableInt;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -17,15 +15,24 @@ import com.mojang.serialization.Codec;
|
|||
import com.simibubi.create.content.logistics.BigItemStack;
|
||||
import com.simibubi.create.content.logistics.stockTicker.LogisticalStockResponsePacket;
|
||||
|
||||
import net.createmod.catnip.codecs.CatnipCodecUtils;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class InventorySummary {
|
||||
public static Codec<InventorySummary> CODEC = Codec.list(BigItemStack.CODEC)
|
||||
.xmap(i -> {
|
||||
InventorySummary summary = new InventorySummary();
|
||||
summary.addAllBigItemStacks(i);
|
||||
return summary;
|
||||
},
|
||||
i -> {
|
||||
List<BigItemStack> all = new ArrayList<>();
|
||||
i.items.forEach((key, list) -> all.addAll(list));
|
||||
return all;
|
||||
});
|
||||
|
||||
public static final InventorySummary EMPTY = new InventorySummary();
|
||||
|
||||
|
@ -179,21 +186,6 @@ public class InventorySummary {
|
|||
CatnipServices.NETWORK.sendToClient(player, new LogisticalStockResponsePacket(true, pos, currentList));
|
||||
}
|
||||
|
||||
// TODO - Create codec for this
|
||||
public CompoundTag write(HolderLookup.Provider registries) {
|
||||
List<BigItemStack> all = new ArrayList<>();
|
||||
items.forEach((key, list) -> all.addAll(list));
|
||||
CompoundTag tag = new CompoundTag();
|
||||
tag.put("List", CatnipCodecUtils.encode(Codec.list(BigItemStack.CODEC), registries, all).orElseThrow());
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static InventorySummary read(CompoundTag tag, HolderLookup.Provider registries) {
|
||||
InventorySummary summary = new InventorySummary();
|
||||
summary.addAllBigItemStacks(CatnipCodecUtils.decode(Codec.list(BigItemStack.CODEC), registries, tag.getCompound("List")).orElse(Collections.emptyList()));
|
||||
return summary;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return items.isEmpty();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.simibubi.create.foundation.blockEntity.behaviour.inventory.InvManipul
|
|||
import com.simibubi.create.foundation.blockEntity.behaviour.inventory.VersionedInventoryTrackerBehaviour;
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
|
||||
import net.createmod.catnip.codecs.CatnipCodecUtils;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.createmod.catnip.nbt.NBTHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -53,6 +54,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
|||
import net.minecraft.world.level.block.entity.SignBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.SignText;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
|
||||
import net.neoforged.neoforge.items.IItemHandler;
|
||||
|
@ -613,7 +615,8 @@ public class PackagerBlockEntity extends SmartBlockEntity {
|
|||
return;
|
||||
queuedExitingPackages = NBTHelper.readItemList(compound.getList("QueuedPackages", Tag.TAG_COMPOUND), registries);
|
||||
if (compound.contains("LastSummary"))
|
||||
availableItems = InventorySummary.read(compound.getCompound("LastSummary"), registries);
|
||||
availableItems = CatnipCodecUtils.decode(InventorySummary.CODEC, registries, compound.getCompound("LastSummary"))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -629,7 +632,7 @@ public class PackagerBlockEntity extends SmartBlockEntity {
|
|||
return;
|
||||
compound.put("QueuedPackages", NBTHelper.writeItemList(queuedExitingPackages, registries));
|
||||
if (availableItems != null)
|
||||
compound.put("LastSummary", availableItems.write(registries));
|
||||
compound.put("LastSummary", CatnipCodecUtils.encode(InventorySummary.CODEC, availableItems).orElseThrow());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.world.inventory.MenuType;
|
|||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import net.neoforged.neoforge.items.IItemHandler;
|
||||
import net.neoforged.neoforge.items.ItemStackHandler;
|
||||
import net.neoforged.neoforge.items.SlotItemHandler;
|
||||
|
@ -74,7 +75,6 @@ public class StockKeeperCategoryMenu extends MenuBase<StockTickerBlockEntity> {
|
|||
|
||||
@Override
|
||||
public boolean stillValid(Player player) {
|
||||
// TODO - Should this use block interaction range when entity interaction range is a thing?
|
||||
return !contentHolder.isRemoved() && player.position()
|
||||
.closerThan(Vec3.atCenterOf(contentHolder.getBlockPos()), player.getAttributeValue(Attributes.BLOCK_INTERACTION_RANGE) + 4);
|
||||
}
|
||||
|
|
|
@ -7,9 +7,6 @@ import java.util.Optional;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -30,6 +27,7 @@ import net.createmod.catnip.animation.LerpedFloat;
|
|||
import net.createmod.catnip.animation.LerpedFloat.Chaser;
|
||||
import net.createmod.catnip.gui.UIRenderHelper;
|
||||
import net.createmod.catnip.gui.element.GuiGameElement;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
|
@ -163,7 +161,6 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
|
|||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
|
||||
// TODO - Is this really needed? We already get passed partialTick by the render method
|
||||
partialTicks = AnimationTickHolder.getPartialTicksUI();
|
||||
|
||||
if (menu.slotsActive)
|
||||
|
@ -369,7 +366,6 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
|
|||
boolean mouseClicked = super.mouseClicked(pMouseX, pMouseY, pButton);
|
||||
|
||||
if (editorEditBox != null && editorEditBox.isMouseOver(pMouseX, pMouseY) && wasNotFocused) {
|
||||
// TODO - Checkover the select = false part
|
||||
editorEditBox.moveCursorToEnd(false);
|
||||
editorEditBox.setHighlightPos(0);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.world.scores.ScoreHolder;
|
|||
import net.minecraft.world.scores.Scoreboard;
|
||||
import net.minecraft.world.scores.criteria.ObjectiveCriteria;
|
||||
import net.minecraft.world.scores.criteria.ObjectiveCriteria.RenderType;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -31,7 +32,6 @@ public abstract class StatTrackingDisplaySource extends ScoreboardDisplaySource
|
|||
String name = "create_auto_" + getObjectiveName();
|
||||
Scoreboard scoreboard = level.getScoreboard();
|
||||
if (scoreboard.getObjective(name) == null)
|
||||
// FIXME 1.21: check over
|
||||
scoreboard.addObjective(name, ObjectiveCriteria.DUMMY, getObjectiveDisplayName(), RenderType.INTEGER, false, null);
|
||||
Objective objective = scoreboard.getObjective(name);
|
||||
|
||||
|
|
|
@ -66,18 +66,18 @@ import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollVa
|
|||
import com.simibubi.create.foundation.fluid.FluidHelper;
|
||||
import com.simibubi.create.foundation.item.TooltipModifier;
|
||||
import com.simibubi.create.foundation.networking.LeftClickPacket;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import com.simibubi.create.foundation.sound.SoundScapes;
|
||||
import com.simibubi.create.foundation.utility.CameraAngleAnimationService;
|
||||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||
import com.simibubi.create.foundation.utility.TickBasedCache;
|
||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||
|
||||
import net.createmod.catnip.animation.AnimationTickHolder;
|
||||
import net.createmod.catnip.config.ui.BaseConfigScreen;
|
||||
import net.createmod.catnip.levelWrappers.WrappedClientLevel;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.createmod.catnip.render.DefaultSuperRenderTypeBuffer;
|
||||
import net.createmod.catnip.render.SuperRenderTypeBuffer;
|
||||
import net.createmod.catnip.animation.AnimationTickHolder;
|
||||
import net.createmod.catnip.levelWrappers.WrappedClientLevel;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
|
@ -91,6 +91,7 @@ import net.minecraft.world.level.LevelAccessor;
|
|||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.ModContainer;
|
||||
|
@ -102,7 +103,6 @@ import net.neoforged.neoforge.client.event.ClientTickEvent;
|
|||
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
|
||||
import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
|
||||
import net.neoforged.neoforge.client.event.RegisterGuiLayersEvent;
|
||||
import net.neoforged.neoforge.client.event.RenderFrameEvent;
|
||||
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
|
||||
import net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage;
|
||||
import net.neoforged.neoforge.client.event.ViewportEvent;
|
||||
|
@ -280,9 +280,17 @@ public class ClientEvents {
|
|||
SequencedAssemblyRecipe.addToTooltip(event);
|
||||
}
|
||||
|
||||
// FIXME 1.21: should this be pre or post?
|
||||
@SubscribeEvent
|
||||
public static void onRenderFrame(RenderFrameEvent.Post event) {
|
||||
public static void onRenderFramePre(ClientTickEvent.Pre event) {
|
||||
onRenderFrame(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderFramePost(ClientTickEvent.Post event) {
|
||||
onRenderFrame(false);
|
||||
}
|
||||
|
||||
public static void onRenderFrame(boolean isPreEvent) {
|
||||
if (!isGameActive())
|
||||
return;
|
||||
TurntableHandler.gameRenderFrame();
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package com.simibubi.create.foundation.events.custom;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingEvent;
|
||||
|
||||
public class EntityLootEnchantmentLevelEvent extends LivingEvent {
|
||||
|
||||
@Nullable
|
||||
private final DamageSource damageSource;
|
||||
|
||||
@NotNull
|
||||
private final Holder<Enchantment> enchantment;
|
||||
|
||||
private int level;
|
||||
|
||||
public EntityLootEnchantmentLevelEvent(LivingEntity target, @Nullable DamageSource damageSource,
|
||||
@NotNull Holder<Enchantment> enchantment, int level) {
|
||||
super(target);
|
||||
|
||||
this.damageSource = damageSource;
|
||||
this.enchantment = enchantment;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public @Nullable DamageSource getDamageSource() {
|
||||
return damageSource;
|
||||
}
|
||||
|
||||
public @NotNull Holder<Enchantment> getEnchantment() {
|
||||
return enchantment;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import org.lwjgl.glfw.GLFW;
|
|||
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
|
||||
import net.createmod.catnip.animation.AnimationTickHolder;
|
||||
import net.createmod.catnip.gui.TickableGuiEventListener;
|
||||
import net.createmod.catnip.gui.widget.AbstractSimiWidget;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -27,6 +28,7 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -105,8 +107,7 @@ public abstract class AbstractSimiContainerScreen<T extends AbstractContainerMen
|
|||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
|
||||
// FIXME 1.21: Checkover
|
||||
partialTicks = minecraft.getTimer().getGameTimeDeltaPartialTick(false);
|
||||
partialTicks = AnimationTickHolder.getPartialTicksUI();
|
||||
|
||||
super.render(graphics, mouseX, mouseY, partialTicks);
|
||||
|
||||
|
|
|
@ -3,34 +3,21 @@ 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.Unique;
|
||||
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.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.simibubi.create.foundation.events.custom.EntityLootEnchantmentLevelEvent;
|
||||
import com.simibubi.create.AllDamageTypes;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.functions.EnchantedCountIncreaseFunction;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
|
||||
@Mixin(EnchantedCountIncreaseFunction.class)
|
||||
public abstract class EnchantedCountIncreaseFunctionMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private Holder<Enchantment> enchantment;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private NumberProvider value;
|
||||
|
@ -42,44 +29,16 @@ public abstract class EnchantedCountIncreaseFunctionMixin {
|
|||
@Final
|
||||
private int limit;
|
||||
|
||||
@WrapOperation(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/EnchantmentHelper;getEnchantmentLevel(Lnet/minecraft/core/Holder;Lnet/minecraft/world/entity/LivingEntity;)I"))
|
||||
private int fireWithAttackingEntity(Holder<Enchantment> enchantmentHolder, LivingEntity attacker,
|
||||
Operation<Integer> original, @Local(argsOnly = true) LootContext context) {
|
||||
int level = original.call(enchantmentHolder, attacker);
|
||||
return create$getLevel(context, enchantmentHolder, level);
|
||||
}
|
||||
|
||||
@Inject(method = "run", at = @At(value = "RETURN", ordinal = 1))
|
||||
@Inject(method = "run", at = @At("TAIL"))
|
||||
private void fireWithoutAttackingEntity(ItemStack stack, LootContext context, CallbackInfoReturnable<ItemStack> cir) {
|
||||
Entity attacker = context.getParamOrNull(LootContextParams.ATTACKING_ENTITY);
|
||||
if (!(attacker instanceof LivingEntity))
|
||||
return;
|
||||
DamageSource damageSource = context.getParamOrNull(LootContextParams.DAMAGE_SOURCE);
|
||||
if (damageSource != null && damageSource.is(AllDamageTypes.CRUSH)) {
|
||||
int lootingLevel = 2;
|
||||
|
||||
int level = create$getLevel(context, this.enchantment, 0);
|
||||
if (level == 0)
|
||||
return;
|
||||
|
||||
float f = (float) level * this.value.getFloat(context);
|
||||
stack.grow(Math.round(f));
|
||||
if (this.hasLimit()) {
|
||||
stack.limitSize(this.limit);
|
||||
float f = (float) lootingLevel * this.value.getFloat(context);
|
||||
stack.grow(Math.round(f));
|
||||
if (this.hasLimit())
|
||||
stack.limitSize(this.limit);
|
||||
}
|
||||
}
|
||||
|
||||
@Unique
|
||||
private static int create$getLevel(LootContext context, Holder<Enchantment> enchantmentHolder, int original) {
|
||||
Entity thisEntity = context.getParamOrNull(LootContextParams.THIS_ENTITY);
|
||||
if (!(thisEntity instanceof LivingEntity livingThis))
|
||||
return original;
|
||||
|
||||
DamageSource damageSource = context.getParamOrNull(LootContextParams.DAMAGE_SOURCE);
|
||||
EntityLootEnchantmentLevelEvent event = new EntityLootEnchantmentLevelEvent(
|
||||
livingThis,
|
||||
damageSource,
|
||||
enchantmentHolder,
|
||||
original
|
||||
);
|
||||
NeoForge.EVENT_BUS.post(event);
|
||||
return event.getLevel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +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.CallbackInfoReturnable;
|
||||
|
||||
import com.simibubi.create.AllDamageTypes;
|
||||
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.functions.LootingEnchantFunction;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
|
||||
|
||||
@Mixin(LootingEnchantFunction.class)
|
||||
public abstract class LootingEnchantFunctionMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
NumberProvider value;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
int limit;
|
||||
|
||||
@Shadow
|
||||
abstract boolean hasLimit();
|
||||
|
||||
@Inject(method = "run", at = @At("TAIL"))
|
||||
private void create$crushingWheelsHaveLooting(ItemStack stack, LootContext context, CallbackInfoReturnable<ItemStack> cir) {
|
||||
DamageSource damageSource = context.getParamOrNull(LootContextParams.DAMAGE_SOURCE);
|
||||
if (damageSource != null && damageSource.is(AllDamageTypes.CRUSH)) {
|
||||
int lootingLevel = 2;
|
||||
|
||||
float f = (float) lootingLevel * this.value.getFloat(context);
|
||||
stack.grow(Math.round(f));
|
||||
if (this.hasLimit() && stack.getCount() > this.limit)
|
||||
stack.setCount(this.limit);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,15 +4,12 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import com.simibubi.create.foundation.utility.RecipeGenericsUtil;
|
||||
|
||||
import net.minecraft.server.packs.resources.ResourceManagerReloadListener;
|
||||
|
@ -53,8 +50,7 @@ public class RecipeFinder {
|
|||
}
|
||||
|
||||
private static List<RecipeHolder<? extends Recipe<?>>> startSearch(Level level, Predicate<? super RecipeHolder<? extends Recipe<?>>> conditions) {
|
||||
//noinspection RedundantCast
|
||||
return (List<RecipeHolder<? extends Recipe<?>>>) RecipeGenericsUtil.specify(level.getRecipeManager().getRecipes())
|
||||
return RecipeGenericsUtil.specify(level.getRecipeManager().getRecipes())
|
||||
.stream()
|
||||
.filter(conditions)
|
||||
.toList();
|
||||
|
|
|
@ -63,8 +63,8 @@ import net.minecraft.world.level.block.state.properties.SlabType;
|
|||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.common.SpecialPlantable;
|
||||
import net.neoforged.neoforge.event.level.BlockDropsEvent;
|
||||
|
@ -322,7 +322,6 @@ public class BlockHelper {
|
|||
|
||||
if (state.getBlock() == Blocks.COMPOSTER)
|
||||
state = Blocks.COMPOSTER.defaultBlockState();
|
||||
// FIXME 1.21: I'm not really sure about this one - there is WAY too little documentation about 'plants'
|
||||
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof SpecialPlantable specialPlantable) {
|
||||
alreadyPlaced = true;
|
||||
if (specialPlantable.canPlacePlantAtPosition(stack, world, target, null))
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.fml.loading.FMLLoader;
|
||||
|
||||
// TODO - Replace with CatnipServices.PLATFORM.executeOnClientOnly()
|
||||
@ApiStatus.Internal
|
||||
@Deprecated(forRemoval = true, since = "1.21")
|
||||
public class DistExecutor {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package com.simibubi.create.foundation.utility;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||
|
||||
// TODO - See if this can be done in some other way
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class RecipeGenericsUtil {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <P extends Recipe<?>, C extends P> List<RecipeHolder<P>> cast(List<RecipeHolder<C>> list) {
|
||||
|
|
|
@ -78,7 +78,6 @@ public class OpenCreateMenuButton extends Button {
|
|||
@EventBusSubscriber(value = Dist.CLIENT)
|
||||
public static class OpenConfigButtonHandler {
|
||||
|
||||
// FIXME 1.21: check if this should be Pre or Post
|
||||
@SubscribeEvent
|
||||
public static void onGuiInit(ScreenEvent.Init.Post event) {
|
||||
Screen screen = event.getScreen();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
"EnchantedCountIncreaseFunctionMixin",
|
||||
"EntityMixin",
|
||||
"LavaSwimmingMixin",
|
||||
"LootingEnchantFunctionMixin",
|
||||
"MapItemSavedDataMixin",
|
||||
"MobMixin",
|
||||
"PlayerMixin",
|
||||
|
|
Loading…
Add table
Reference in a new issue