mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-14 06:24:29 +01:00
Sequenced Porting
- Resolve all remaining 1.19 errors except for SuperByteBuffer
This commit is contained in:
parent
4b3a972b9b
commit
1797eddf0f
@ -18,7 +18,6 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
public class AllInteractionBehaviours {
|
||||
private static final CreateRegistry<Block, MovingInteractionBehaviour> BLOCK_BEHAVIOURS = new CreateRegistry<>(ForgeRegistries.BLOCKS);
|
||||
@ -32,11 +31,6 @@ public class AllInteractionBehaviours {
|
||||
BLOCK_BEHAVIOURS.register(block, provider);
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static void registerBehaviour(IRegistryDelegate<Block> block, MovingInteractionBehaviour provider) {
|
||||
registerBehaviour(block.name(), provider);
|
||||
}
|
||||
|
||||
public static void registerBehaviourProvider(BehaviourProvider provider) {
|
||||
GLOBAL_BEHAVIOURS.add(provider);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
public class AllMovementBehaviours {
|
||||
private static final CreateRegistry<Block, MovementBehaviour> BLOCK_BEHAVIOURS = new CreateRegistry<>(ForgeRegistries.BLOCKS);
|
||||
@ -32,11 +31,6 @@ public class AllMovementBehaviours {
|
||||
BLOCK_BEHAVIOURS.register(block, behaviour);
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static void registerBehaviour(IRegistryDelegate<Block> block, MovementBehaviour behaviour) {
|
||||
registerBehaviour(block.name(), behaviour);
|
||||
}
|
||||
|
||||
public static void registerBehaviourProvider(BehaviourProvider provider) {
|
||||
GLOBAL_BEHAVIOURS.add(provider);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.damagesource.EntityDamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
@ -55,6 +56,7 @@ public class DeployerFakePlayer extends FakePlayer {
|
||||
public DeployerFakePlayer(ServerLevel world) {
|
||||
super(world, DEPLOYER_PROFILE);
|
||||
connection = new FakePlayNetHandler(world.getServer(), this);
|
||||
this.playEquipSound(spawnedItemEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,7 +118,12 @@ public class DeployerFakePlayer extends FakePlayer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void equipEventAndSound(ItemStack p_147219_) {}
|
||||
protected boolean doesEmitEquipEvent(EquipmentSlot p_217035_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void playEquipSound(ItemStack p_217042_) {}
|
||||
|
||||
@Override
|
||||
public void remove(RemovalReason p_150097_) {
|
||||
|
@ -17,7 +17,6 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
public class BoilerHeaters {
|
||||
private static final CreateRegistry<Block, Heater> BLOCK_HEATERS = new CreateRegistry<>(ForgeRegistries.BLOCKS);
|
||||
@ -31,11 +30,6 @@ public class BoilerHeaters {
|
||||
BLOCK_HEATERS.register(block, heater);
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static void registerHeater(IRegistryDelegate<Block> block, Heater heater) {
|
||||
registerHeater(block.name(), heater);
|
||||
}
|
||||
|
||||
public static void registerHeaterProvider(HeaterProvider provider) {
|
||||
GLOBAL_HEATERS.add(provider);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> {
|
||||
return super.getQuads(state, side, rand, data, renderType);
|
||||
}
|
||||
|
||||
// TODO: move to Flywheel's ModelUtil
|
||||
// TODO 1.19: move to Flywheel's ModelUtil
|
||||
private static boolean isVirtual(ModelData data) {
|
||||
return data.has(ModelUtil.VIRTUAL_PROPERTY) && data.get(ModelUtil.VIRTUAL_PROPERTY);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import net.minecraft.client.renderer.entity.RenderLayerParent;
|
||||
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.StringUtil;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
@ -35,6 +34,7 @@ import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.gui.overlay.ForgeGui;
|
||||
import net.minecraftforge.client.gui.overlay.IGuiOverlay;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
|
||||
public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> {
|
||||
|
||||
@ -119,7 +119,7 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
|
||||
if (!player.getPersistentData()
|
||||
.contains("VisualBacktankAir"))
|
||||
return;
|
||||
if (!player.isEyeInFluid(FluidTags.WATER))
|
||||
if (!player.isEyeInFluidType(ForgeMod.WATER_TYPE.get()))
|
||||
return;
|
||||
|
||||
int timeLeft = player.getPersistentData()
|
||||
|
@ -27,7 +27,6 @@ import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
@ -114,7 +113,7 @@ public class CopperBacktankBlock extends HorizontalKineticBlock
|
||||
if (stack == null)
|
||||
return;
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
te.setCapacityEnchantLevel(EnchantmentHelper.getItemEnchantmentLevel(AllEnchantments.CAPACITY.get(), stack));
|
||||
te.setCapacityEnchantLevel(stack.getEnchantmentLevel(AllEnchantments.CAPACITY.get()));
|
||||
te.setAirLevel(stack.getOrCreateTag()
|
||||
.getInt("Air"));
|
||||
if (stack.isEnchanted())
|
||||
|
@ -4,7 +4,6 @@ import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
@ -12,6 +11,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingTickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
@ -38,8 +38,8 @@ public class DivingHelmetItem extends CopperArmorItem {
|
||||
.isWornBy(entity))
|
||||
return;
|
||||
|
||||
boolean lavaDiving = entity.isEyeInFluid(FluidTags.LAVA);
|
||||
if (!entity.isEyeInFluid(FluidTags.WATER) && !lavaDiving)
|
||||
boolean lavaDiving = entity.isEyeInFluidType(ForgeMod.LAVA_TYPE.get());
|
||||
if (!entity.isEyeInFluidType(ForgeMod.WATER_TYPE.get()) && !lavaDiving)
|
||||
return;
|
||||
if (entity instanceof Player && ((Player) entity).isCreative())
|
||||
return;
|
||||
|
@ -44,6 +44,7 @@ import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.entity.EntityTeleportEvent;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class BuiltinPotatoProjectileTypes {
|
||||
|
||||
@ -329,7 +330,7 @@ public class BuiltinPotatoProjectileTypes {
|
||||
}
|
||||
|
||||
private static BiPredicate<LevelAccessor, BlockHitResult> plantCrop(Block cropBlock) {
|
||||
return plantCrop(cropBlock.delegate);
|
||||
return plantCrop(ForgeRegistries.BLOCKS.getDelegateOrThrow(cropBlock));
|
||||
}
|
||||
|
||||
private static BiPredicate<LevelAccessor, BlockHitResult> placeBlockOnGround(
|
||||
@ -369,7 +370,7 @@ public class BuiltinPotatoProjectileTypes {
|
||||
}
|
||||
|
||||
private static BiPredicate<LevelAccessor, BlockHitResult> placeBlockOnGround(Block block) {
|
||||
return placeBlockOnGround(block.delegate);
|
||||
return placeBlockOnGround(ForgeRegistries.BLOCKS.getDelegateOrThrow(block));
|
||||
}
|
||||
|
||||
private static Predicate<EntityHitResult> chorusTeleport(double teleportDiameter) {
|
||||
|
@ -37,7 +37,6 @@ import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.UseAnim;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
@ -211,8 +210,8 @@ public class PotatoCannonItem extends ProjectileWeaponItem {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void appendHoverText(ItemStack stack, Level world, List<Component> tooltip, TooltipFlag flag) {
|
||||
int power = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.POWER_ARROWS, stack);
|
||||
int punch = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.PUNCH_ARROWS, stack);
|
||||
int power = stack.getEnchantmentLevel(Enchantments.POWER_ARROWS);
|
||||
int punch = stack.getEnchantmentLevel(Enchantments.PUNCH_ARROWS);
|
||||
final float additionalDamageMult = 1 + power * .2f;
|
||||
final float additionalKnockback = punch * .5f;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.simibubi.create.content.curiosities.weapons;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
@ -13,6 +14,7 @@ import com.google.gson.JsonPrimitive;
|
||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||
|
||||
import net.minecraft.ResourceLocationException;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
@ -110,9 +112,9 @@ public class PotatoCannonProjectileType {
|
||||
JsonPrimitive primitive = element.getAsJsonPrimitive();
|
||||
if (primitive.isString()) {
|
||||
try {
|
||||
Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(primitive.getAsString()));
|
||||
if (item != null) {
|
||||
type.items.add(item.delegate);
|
||||
Optional<Holder.Reference<Item>> reference = ForgeRegistries.ITEMS.getDelegate(new ResourceLocation(primitive.getAsString()));
|
||||
if (reference.isPresent()) {
|
||||
type.items.add(reference.get());
|
||||
}
|
||||
} catch (ResourceLocationException e) {
|
||||
//
|
||||
@ -167,9 +169,9 @@ public class PotatoCannonProjectileType {
|
||||
PotatoCannonProjectileType type = new PotatoCannonProjectileType();
|
||||
int size = buffer.readVarInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Item item = ForgeRegistries.ITEMS.getValue(buffer.readResourceLocation());
|
||||
if (item != null) {
|
||||
type.items.add(item.delegate);
|
||||
Optional<Holder.Reference<Item>> reference = ForgeRegistries.ITEMS.getDelegate(buffer.readResourceLocation());
|
||||
if (reference.isPresent()) {
|
||||
type.items.add(reference.get());
|
||||
}
|
||||
}
|
||||
type.reloadTicks = buffer.readInt();
|
||||
@ -276,7 +278,7 @@ public class PotatoCannonProjectileType {
|
||||
|
||||
public Builder addItems(ItemLike... items) {
|
||||
for (ItemLike provider : items)
|
||||
result.items.add(provider.asItem().delegate);
|
||||
result.items.add(ForgeRegistries.ITEMS.getDelegateOrThrow(provider.asItem()));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -71,10 +71,10 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements
|
||||
}
|
||||
|
||||
public void setEnchantmentEffectsFromCannon(ItemStack cannon) {
|
||||
int power = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.POWER_ARROWS, cannon);
|
||||
int punch = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.PUNCH_ARROWS, cannon);
|
||||
int flame = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.FLAMING_ARROWS, cannon);
|
||||
int recovery = EnchantmentHelper.getItemEnchantmentLevel(AllEnchantments.POTATO_RECOVERY.get(), cannon);
|
||||
int power = cannon.getEnchantmentLevel(Enchantments.POWER_ARROWS);
|
||||
int punch = cannon.getEnchantmentLevel(Enchantments.PUNCH_ARROWS);
|
||||
int flame = cannon.getEnchantmentLevel(Enchantments.FLAMING_ARROWS);
|
||||
int recovery = cannon.getEnchantmentLevel(AllEnchantments.POTATO_RECOVERY.get());
|
||||
|
||||
if (power > 0)
|
||||
additionalDamageMult = 1 + power * .2f;
|
||||
|
@ -30,16 +30,15 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
public class AllDisplayBehaviours {
|
||||
public static final Map<ResourceLocation, DisplayBehaviour> GATHERER_BEHAVIOURS = new HashMap<>();
|
||||
|
||||
private static final CreateRegistry<Block, List<DisplaySource>> SOURCES_BY_BLOCK = new CreateRegistry<>(ForgeRegistries.BLOCKS);
|
||||
private static final CreateRegistry<BlockEntityType<?>, List<DisplaySource>> SOURCES_BY_TILE = new CreateRegistry<>(ForgeRegistries.BLOCK_ENTITIES);
|
||||
private static final CreateRegistry<BlockEntityType<?>, List<DisplaySource>> SOURCES_BY_TILE = new CreateRegistry<>(ForgeRegistries.BLOCK_ENTITY_TYPES);
|
||||
|
||||
private static final CreateRegistry<Block, DisplayTarget> TARGETS_BY_BLOCK = new CreateRegistry<>(ForgeRegistries.BLOCKS);
|
||||
private static final CreateRegistry<BlockEntityType<?>, DisplayTarget> TARGETS_BY_TILE = new CreateRegistry<>(ForgeRegistries.BLOCK_ENTITIES);
|
||||
private static final CreateRegistry<BlockEntityType<?>, DisplayTarget> TARGETS_BY_TILE = new CreateRegistry<>(ForgeRegistries.BLOCK_ENTITY_TYPES);
|
||||
|
||||
public static DisplayBehaviour register(ResourceLocation id, DisplayBehaviour behaviour) {
|
||||
behaviour.id = id;
|
||||
@ -103,16 +102,6 @@ public class AllDisplayBehaviours {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static void assignBlock(DisplayBehaviour behaviour, IRegistryDelegate<Block> block) {
|
||||
assignBlock(behaviour, block.name());
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static void assignTile(DisplayBehaviour behaviour, IRegistryDelegate<BlockEntityType<?>> teType) {
|
||||
assignTile(behaviour, teType.name());
|
||||
}
|
||||
|
||||
public static <B extends Block> NonNullConsumer<? super B> assignDataBehaviour(DisplayBehaviour behaviour,
|
||||
String... suffix) {
|
||||
return b -> {
|
||||
|
@ -51,7 +51,7 @@ public class EnchantAttribute implements ItemAttribute {
|
||||
public void writeNBT(CompoundTag nbt) {
|
||||
if (enchantment == null)
|
||||
return;
|
||||
ResourceLocation id = enchantment.getRegistryName();
|
||||
ResourceLocation id = ForgeRegistries.ENCHANTMENTS.getKey(enchantment);
|
||||
if (id == null)
|
||||
return;
|
||||
nbt.putString("id", id.toString());
|
||||
|
@ -7,7 +7,6 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.simibubi.create.content.logistics.item.filter.ItemAttribute;
|
||||
import com.simibubi.create.foundation.utility.Components;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@ -54,7 +53,7 @@ public class FluidContentsAttribute implements ItemAttribute {
|
||||
public void writeNBT(CompoundTag nbt) {
|
||||
if (fluid == null)
|
||||
return;
|
||||
ResourceLocation id = fluid.getRegistryName();
|
||||
ResourceLocation id = ForgeRegistries.FLUIDS.getKey(fluid);
|
||||
if (id == null)
|
||||
return;
|
||||
nbt.putString("id", id.toString());
|
||||
|
@ -9,6 +9,7 @@ import com.simibubi.create.foundation.utility.Components;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class AstralSorceryAttunementAttribute implements ItemAttribute {
|
||||
String constellationName;
|
||||
@ -23,7 +24,7 @@ public class AstralSorceryAttunementAttribute implements ItemAttribute {
|
||||
String constellation = nbt.contains("constellation") ? nbt.getString("constellation") : nbt.getString("constellationName");
|
||||
|
||||
// Special handling for shifting stars
|
||||
ResourceLocation itemResource = itemStack.getItem().getRegistryName();
|
||||
ResourceLocation itemResource = ForgeRegistries.ITEMS.getKey(itemStack.getItem());
|
||||
if (itemResource != null && itemResource.toString().contains("shifting_star_")) {
|
||||
constellation = itemResource.toString().replace("shifting_star_", "");
|
||||
}
|
||||
@ -37,7 +38,7 @@ public class AstralSorceryAttunementAttribute implements ItemAttribute {
|
||||
String constellation = nbt.contains("constellation") ? nbt.getString("constellation") : nbt.getString("constellationName");
|
||||
|
||||
// Special handling for shifting stars
|
||||
ResourceLocation itemResource = itemStack.getItem().getRegistryName();
|
||||
ResourceLocation itemResource = ForgeRegistries.ITEMS.getKey(itemStack.getItem());
|
||||
if (itemResource != null && itemResource.toString().contains("shifting_star_")) {
|
||||
constellation = itemResource.toString().replace("shifting_star_", "");
|
||||
}
|
||||
|
@ -30,15 +30,18 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkSource;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.level.entity.LevelEntityGetter;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.gameevent.GameEvent.Context;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||
import net.minecraft.world.level.storage.WritableLevelData;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
import net.minecraft.world.ticks.BlackholeTickAccess;
|
||||
import net.minecraft.world.ticks.LevelTickAccess;
|
||||
@ -95,8 +98,8 @@ public class SchematicChunkSource extends ChunkSource {
|
||||
private RegistryAccess access;
|
||||
|
||||
private DummyLevel(WritableLevelData p_46450_, ResourceKey<Level> p_46451_, Holder<DimensionType> p_46452_,
|
||||
Supplier<ProfilerFiller> p_46453_, boolean p_46454_, boolean p_46455_, long p_46456_) {
|
||||
super(p_46450_, p_46451_, p_46452_, p_46453_, p_46454_, p_46455_, p_46456_);
|
||||
Supplier<ProfilerFiller> p_46453_, boolean p_46454_, boolean p_46455_, long p_46456_, int p_220359_) {
|
||||
super(p_46450_, p_46451_, p_46452_, p_46453_, p_46454_, p_46455_, p_46456_, p_220359_);
|
||||
}
|
||||
|
||||
public Level withAccess(RegistryAccess access) {
|
||||
@ -115,6 +118,9 @@ public class SchematicChunkSource extends ChunkSource {
|
||||
@Override
|
||||
public void gameEvent(Entity pEntity, GameEvent pEvent, BlockPos pPos) {}
|
||||
|
||||
@Override
|
||||
public void gameEvent(GameEvent p_220404_, Vec3 p_220405_, Context p_220406_) {}
|
||||
|
||||
@Override
|
||||
public RegistryAccess registryAccess() {
|
||||
return access;
|
||||
@ -146,6 +152,14 @@ public class SchematicChunkSource extends ChunkSource {
|
||||
public void playSound(Player pPlayer, Entity pEntity, SoundEvent pEvent, SoundSource pCategory,
|
||||
float pVolume, float pPitch) {}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(Player p_220363_, double p_220364_, double p_220365_, double p_220366_,
|
||||
SoundEvent p_220367_, SoundSource p_220368_, float p_220369_, float p_220370_, long p_220371_) {}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(Player p_220372_, Entity p_220373_, SoundEvent p_220374_, SoundSource p_220375_,
|
||||
float p_220376_, float p_220377_, long p_220378_) {}
|
||||
|
||||
@Override
|
||||
public String gatherChunkSourceStats() {
|
||||
return null;
|
||||
@ -200,7 +214,7 @@ public class SchematicChunkSource extends ChunkSource {
|
||||
|
||||
private static final DummyLevel DUMMY_LEVEL = new DummyLevel(null, null, RegistryAccess.BUILTIN.get()
|
||||
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY)
|
||||
.getHolderOrThrow(DimensionType.OVERWORLD_LOCATION), null, false, false, 0);
|
||||
.getHolderOrThrow(BuiltinDimensionTypes.OVERWORLD), null, false, false, 0, 0);
|
||||
|
||||
public EmptierChunk(RegistryAccess registryAccess) {
|
||||
super(DUMMY_LEVEL.withAccess(registryAccess), null);
|
||||
|
@ -47,10 +47,10 @@ public class CopperBlockSet {
|
||||
|
||||
protected static final Map<WeatherState, Supplier<Block>> BASE_BLOCKS = new EnumMap<>(WeatherState.class);
|
||||
static {
|
||||
BASE_BLOCKS.put(WeatherState.UNAFFECTED, Blocks.COPPER_BLOCK.delegate);
|
||||
BASE_BLOCKS.put(WeatherState.EXPOSED, Blocks.EXPOSED_COPPER.delegate);
|
||||
BASE_BLOCKS.put(WeatherState.WEATHERED, Blocks.WEATHERED_COPPER.delegate);
|
||||
BASE_BLOCKS.put(WeatherState.OXIDIZED, Blocks.OXIDIZED_COPPER.delegate);
|
||||
BASE_BLOCKS.put(WeatherState.UNAFFECTED, () -> Blocks.COPPER_BLOCK);
|
||||
BASE_BLOCKS.put(WeatherState.EXPOSED, () -> Blocks.EXPOSED_COPPER);
|
||||
BASE_BLOCKS.put(WeatherState.WEATHERED, () -> Blocks.WEATHERED_COPPER);
|
||||
BASE_BLOCKS.put(WeatherState.OXIDIZED, () -> Blocks.OXIDIZED_COPPER);
|
||||
}
|
||||
|
||||
public static final Variant<?>[] DEFAULT_VARIANTS =
|
||||
|
@ -117,7 +117,7 @@ public class BuilderTransformers {
|
||||
.blockstate((c, p) -> {
|
||||
ModelFile bottom = AssetLookup.partialBaseModel(c, p, "bottom");
|
||||
ModelFile top = AssetLookup.partialBaseModel(c, p, "top");
|
||||
p.doorBlock(c.get(), bottom, bottom, top, top);
|
||||
p.doorBlock(c.get(), bottom, bottom, bottom, bottom, top, top, top, top);
|
||||
})
|
||||
.addLayer(() -> RenderType::cutoutMipped)
|
||||
.transform(pickaxeOnly())
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.simibubi.create.foundation.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
@ -12,12 +12,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.lang3.mutable.MutableInt;
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.hash.HashCode;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
@ -29,7 +30,6 @@ import com.simibubi.create.foundation.utility.FilesHelper;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.HashCache;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
|
||||
public class LangMerger implements DataProvider {
|
||||
@ -225,24 +225,13 @@ public class LangMerger implements DataProvider {
|
||||
.getAsJsonObject());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void save(CachedOutput cache, List<Object> dataIn, int missingKeys, Path target, String message)
|
||||
throws IOException {
|
||||
String data = createString(dataIn, missingKeys);
|
||||
// data = JavaUnicodeEscaper.outsideOf(0, 0x7f)
|
||||
// .translate(data);
|
||||
String hash = DataProvider.SHA1.hashUnencodedChars(data)
|
||||
.toString();
|
||||
if (!Objects.equals(cache.getHash(target), hash) || !Files.exists(target)) {
|
||||
Files.createDirectories(target.getParent());
|
||||
|
||||
try (BufferedWriter bufferedwriter = Files.newBufferedWriter(target)) {
|
||||
Create.LOGGER.info(message);
|
||||
bufferedwriter.write(data);
|
||||
bufferedwriter.close();
|
||||
}
|
||||
}
|
||||
|
||||
cache.putNew(target, hash);
|
||||
byte[] data = createString(dataIn, missingKeys).getBytes(StandardCharsets.UTF_8);
|
||||
HashCode hash = Hashing.sha1().hashBytes(data);
|
||||
cache.writeIfNeeded(target, data, hash);
|
||||
}
|
||||
|
||||
protected String createString(List<Object> data, int missingKeys) {
|
||||
|
@ -19,7 +19,6 @@ import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
|
||||
public abstract class ProcessingRecipeGen extends CreateRecipeProvider {
|
||||
|
@ -14,7 +14,7 @@ import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.client.RenderProperties;
|
||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public abstract class CustomRenderedItemModelRenderer<M extends CustomRenderedItemModel> extends BlockEntityWithoutLevelRenderer {
|
||||
@ -57,7 +57,7 @@ public abstract class CustomRenderedItemModelRenderer<M extends CustomRenderedIt
|
||||
public static void acceptModelFuncs(NonNullBiConsumer<Item, NonNullFunction<BakedModel, ? extends CustomRenderedItemModel>> consumer) {
|
||||
for (Item item : ITEMS) {
|
||||
if (ForgeRegistries.ITEMS.containsValue(item)) {
|
||||
BlockEntityWithoutLevelRenderer renderer = RenderProperties.get(item).getItemStackRenderer();
|
||||
BlockEntityWithoutLevelRenderer renderer = IClientItemExtensions.of(item).getCustomRenderer();
|
||||
if (renderer instanceof CustomRenderedItemModelRenderer<?> customRenderer) {
|
||||
consumer.accept(item, customRenderer::createModel);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ public enum AllPackets {
|
||||
channel.messageBuilder(type, index++, direction)
|
||||
.encoder(encoder)
|
||||
.decoder(decoder)
|
||||
.consumer(handler)
|
||||
.consumerNetworkThread(handler)
|
||||
.add();
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,33 @@
|
||||
package com.simibubi.create.foundation.utility;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.KeybindComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
|
||||
public final class Components {
|
||||
private static final Component IMMUTABLE_EMPTY = Component.empty();
|
||||
|
||||
public static Component immutableEmpty() {
|
||||
return TextComponent.EMPTY;
|
||||
return IMMUTABLE_EMPTY;
|
||||
}
|
||||
|
||||
/** Use {@link #immutableEmpty()} when possible to prevent creating an extra object. */
|
||||
public static MutableComponent empty() {
|
||||
return TextComponent.EMPTY.copy();
|
||||
return Component.empty();
|
||||
}
|
||||
|
||||
public static MutableComponent literal(String str) {
|
||||
return new TextComponent(str);
|
||||
return Component.literal(str);
|
||||
}
|
||||
|
||||
public static MutableComponent translatable(String key) {
|
||||
return new TranslatableComponent(key);
|
||||
return Component.translatable(key);
|
||||
}
|
||||
|
||||
public static MutableComponent translatable(String key, Object... args) {
|
||||
return new TranslatableComponent(key, args);
|
||||
return Component.translatable(key, args);
|
||||
}
|
||||
|
||||
public static MutableComponent keybind(String name) {
|
||||
return new KeybindComponent(name);
|
||||
return Component.keybind(name);
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,8 @@ import com.simibubi.create.Create;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public class CreateRegistry<K extends IForgeRegistryEntry<K>, V> {
|
||||
public class CreateRegistry<K, V> {
|
||||
private static final List<CreateRegistry<?, ?>> ALL = new ArrayList<>();
|
||||
|
||||
protected final IForgeRegistry<K> objectRegistry;
|
||||
|
@ -13,13 +13,12 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public final class RegisteredObjects {
|
||||
// registry argument for easier porting to 1.19
|
||||
@NotNull
|
||||
public static <V extends IForgeRegistryEntry<V>> ResourceLocation getKeyOrThrow(IForgeRegistry<V> registry, V value) {
|
||||
ResourceLocation key = value.getRegistryName();
|
||||
public static <V> ResourceLocation getKeyOrThrow(IForgeRegistry<V> registry, V value) {
|
||||
ResourceLocation key = registry.getKey(value);
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("Could not get key for value " + value + "!");
|
||||
}
|
||||
@ -43,12 +42,12 @@ public final class RegisteredObjects {
|
||||
|
||||
@NotNull
|
||||
public static ResourceLocation getKeyOrThrow(EntityType<?> value) {
|
||||
return getKeyOrThrow(ForgeRegistries.ENTITIES, value);
|
||||
return getKeyOrThrow(ForgeRegistries.ENTITY_TYPES, value);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ResourceLocation getKeyOrThrow(BlockEntityType<?> value) {
|
||||
return getKeyOrThrow(ForgeRegistries.BLOCK_ENTITIES, value);
|
||||
return getKeyOrThrow(ForgeRegistries.BLOCK_ENTITY_TYPES, value);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -9,7 +9,6 @@ import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
@ -17,10 +16,10 @@ import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.crafting.RecipeManager;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||
import net.minecraft.world.level.storage.ServerLevelData;
|
||||
@ -30,13 +29,14 @@ import net.minecraft.world.ticks.LevelTicks;
|
||||
@MethodsReturnNonnullByDefault
|
||||
public class WrappedServerWorld extends ServerLevel {
|
||||
|
||||
protected Level world;
|
||||
protected ServerLevel world;
|
||||
|
||||
public WrappedServerWorld(Level world) {
|
||||
public WrappedServerWorld(ServerLevel world) {
|
||||
super(world.getServer(), Util.backgroundExecutor(), world.getServer().storageSource,
|
||||
(ServerLevelData) world.getLevelData(), world.dimension(), world.dimensionTypeRegistration(),
|
||||
new DummyStatusListener(), ((ServerChunkCache) world.getChunkSource()).getGenerator(), world.isDebug(),
|
||||
world.getBiomeManager().biomeZoomSeed, Collections.emptyList(), false);
|
||||
(ServerLevelData) world.getLevelData(), world.dimension(),
|
||||
new LevelStem(world.dimensionTypeRegistration(), world.getChunkSource().getGenerator()),
|
||||
new DummyStatusListener(), world.isDebug(), world.getBiomeManager().biomeZoomSeed,
|
||||
Collections.emptyList(), false);
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,12 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkSource;
|
||||
import net.minecraft.world.level.entity.LevelEntityGetter;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.gameevent.GameEvent.Context;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||
import net.minecraft.world.level.storage.WritableLevelData;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
import net.minecraft.world.ticks.LevelTickAccess;
|
||||
|
||||
@ -40,7 +42,7 @@ public class WrappedWorld extends Level {
|
||||
|
||||
public WrappedWorld(Level world) {
|
||||
super((WritableLevelData) world.getLevelData(), world.dimension(), world.dimensionTypeRegistration(),
|
||||
world::getProfiler, world.isClientSide, world.isDebug(), 0);
|
||||
world::getProfiler, world.isClientSide, world.isDebug(), 0, 0);
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@ -111,6 +113,14 @@ public class WrappedWorld extends Level {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(Player p_220363_, double p_220364_, double p_220365_, double p_220366_,
|
||||
SoundEvent p_220367_, SoundSource p_220368_, float p_220369_, float p_220370_, long p_220371_) {}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(Player p_220372_, Entity p_220373_, SoundEvent p_220374_, SoundSource p_220375_,
|
||||
float p_220376_, float p_220377_, long p_220378_) {}
|
||||
|
||||
@Override
|
||||
public void playSound(@Nullable Player player, double x, double y, double z, SoundEvent soundIn,
|
||||
SoundSource category, float volume, float pitch) {}
|
||||
@ -177,6 +187,9 @@ public class WrappedWorld extends Level {
|
||||
@Override
|
||||
public void gameEvent(Entity pEntity, GameEvent pEvent, BlockPos pPos) {}
|
||||
|
||||
@Override
|
||||
public void gameEvent(GameEvent p_220404_, Vec3 p_220405_, Context p_220406_) {}
|
||||
|
||||
@Override
|
||||
public String gatherChunkSourceStats() {
|
||||
return world.gatherChunkSourceStats();
|
||||
|
Loading…
Reference in New Issue
Block a user