Holder Holdups
- Finished work on compilation errors
This commit is contained in:
parent
727b0a463e
commit
2fa65727d5
22 changed files with 188 additions and 143 deletions
|
@ -60,7 +60,6 @@ import com.simibubi.create.foundation.item.TagDependentIngredientItem;
|
|||
import com.simibubi.create.foundation.item.TooltipHelper;
|
||||
import com.tterrag.registrate.util.entry.ItemEntry;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.food.FoodProperties;
|
||||
|
@ -308,7 +307,8 @@ public class AllItems {
|
|||
|
||||
public static final ItemEntry<SymmetryWandItem> WAND_OF_SYMMETRY =
|
||||
REGISTRATE.item("wand_of_symmetry", SymmetryWandItem::new)
|
||||
.properties(p -> p.stacksTo(1).rarity(Rarity.UNCOMMON))
|
||||
.properties(p -> p.stacksTo(1)
|
||||
.rarity(Rarity.UNCOMMON))
|
||||
.model(AssetLookup.itemModelWithPartials())
|
||||
.register();
|
||||
|
||||
|
@ -380,7 +380,7 @@ public class AllItems {
|
|||
String metalName = metal.getName();
|
||||
return REGISTRATE
|
||||
.item("crushed_" + metalName + "_ore",
|
||||
props -> new TagDependentIngredientItem(props, new ResourceLocation("forge", "ores/" + metalName)))
|
||||
props -> new TagDependentIngredientItem(props, AllTags.forgeItemTag("ores/" + metalName)))
|
||||
.tag(CRUSHED_ORES.tag)
|
||||
.register();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import static com.simibubi.create.AllTags.NameSpace.FORGE;
|
|||
import static com.simibubi.create.AllTags.NameSpace.MOD;
|
||||
import static com.simibubi.create.AllTags.NameSpace.TIC;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
|
@ -15,8 +16,6 @@ import com.tterrag.registrate.util.nullness.NonNullFunction;
|
|||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -28,6 +27,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class AllTags {
|
||||
|
||||
|
@ -44,15 +44,18 @@ public class AllTags {
|
|||
}
|
||||
|
||||
public static TagKey<Block> forgeBlockTag(String path) {
|
||||
return forgeTag(BlockTags::createOptional, path);
|
||||
return forgeTag(r -> ForgeRegistries.BLOCKS.tags()
|
||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
||||
}
|
||||
|
||||
public static TagKey<Item> forgeItemTag(String path) {
|
||||
return forgeTag(ItemTags::createOptional, path);
|
||||
return forgeTag(r -> ForgeRegistries.ITEMS.tags()
|
||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
||||
}
|
||||
|
||||
public static TagKey<Fluid> forgeFluidTag(String path) {
|
||||
return forgeTag(FluidTags::createOptional, path);
|
||||
return forgeTag(r -> ForgeRegistries.FLUIDS.tags()
|
||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
||||
}
|
||||
|
||||
public static <T extends Block, P> NonNullFunction<BlockBuilder<T, P>, BlockBuilder<T, P>> axeOrPickaxe() {
|
||||
|
@ -73,7 +76,7 @@ public class AllTags {
|
|||
return b -> {
|
||||
for (String p : path)
|
||||
b.tag(forgeBlockTag(p));
|
||||
ItemBuilder<BlockItem,BlockBuilder<T,P>> item = b.item();
|
||||
ItemBuilder<BlockItem, BlockBuilder<T, P>> item = b.item();
|
||||
for (String p : path)
|
||||
item.tag(forgeItemTag(p));
|
||||
return item;
|
||||
|
@ -82,9 +85,7 @@ public class AllTags {
|
|||
|
||||
public enum NameSpace {
|
||||
|
||||
MOD(Create.ID, false, true),
|
||||
FORGE("forge"),
|
||||
TIC("tconstruct")
|
||||
MOD(Create.ID, false, true), FORGE("forge"), TIC("tconstruct")
|
||||
|
||||
;
|
||||
|
||||
|
@ -119,6 +120,7 @@ public class AllTags {
|
|||
WRENCH_PICKUP,
|
||||
|
||||
WG_STONE(FORGE),
|
||||
RELOCATION_NOT_SUPPORTED(FORGE),
|
||||
|
||||
SLIMY_LOGS(TIC),
|
||||
|
||||
|
@ -145,9 +147,10 @@ public class AllTags {
|
|||
AllBlockTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
||||
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
||||
if (optional) {
|
||||
tag = BlockTags.createOptional(id);
|
||||
tag = ForgeRegistries.BLOCKS.tags()
|
||||
.createOptionalTagKey(id, Collections.emptySet());
|
||||
} else {
|
||||
tag = BlockTags.bind(id.toString());
|
||||
tag = TagKey.create(ForgeRegistries.BLOCKS.getRegistryKey(), id);
|
||||
}
|
||||
if (alwaysDatagen) {
|
||||
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag));
|
||||
|
@ -155,7 +158,9 @@ public class AllTags {
|
|||
}
|
||||
|
||||
public boolean matches(Block block) {
|
||||
return tag.contains(block);
|
||||
return ForgeRegistries.BLOCKS.getHolder(block)
|
||||
.map(h -> h.containsTag(tag))
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
public boolean matches(BlockState state) {
|
||||
|
@ -221,9 +226,10 @@ public class AllTags {
|
|||
AllItemTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
||||
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
||||
if (optional) {
|
||||
tag = ItemTags.createOptional(id);
|
||||
tag = ForgeRegistries.ITEMS.tags()
|
||||
.createOptionalTagKey(id, Collections.emptySet());
|
||||
} else {
|
||||
tag = ItemTags.bind(id.toString());
|
||||
tag = TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), id);
|
||||
}
|
||||
if (alwaysDatagen) {
|
||||
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag));
|
||||
|
@ -231,7 +237,9 @@ public class AllTags {
|
|||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
return tag.contains(stack.getItem());
|
||||
return ForgeRegistries.ITEMS.getHolder(stack.getItem())
|
||||
.map(h -> h.containsTag(tag))
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
public void add(Item... values) {
|
||||
|
@ -285,17 +293,19 @@ public class AllTags {
|
|||
AllFluidTags(NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
||||
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
||||
if (optional) {
|
||||
tag = FluidTags.createOptional(id);
|
||||
tag = ForgeRegistries.FLUIDS.tags()
|
||||
.createOptionalTagKey(id, Collections.emptySet());
|
||||
} else {
|
||||
tag = FluidTags.bind(id.toString());
|
||||
tag = TagKey.create(ForgeRegistries.FLUIDS.getRegistryKey(), id);
|
||||
}
|
||||
if (alwaysDatagen) {
|
||||
if (alwaysDatagen)
|
||||
REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean matches(Fluid fluid) {
|
||||
return fluid != null && fluid.is(tag);
|
||||
return fluid != null && ForgeRegistries.FLUIDS.getHolder(fluid)
|
||||
.map(h -> h.containsTag(tag))
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
public void add(Fluid... values) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class Create {
|
|||
|
||||
public static final String ID = "create";
|
||||
public static final String NAME = "Create";
|
||||
public static final String VERSION = "0.4f";
|
||||
public static final String VERSION = "0.4.1";
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@ package com.simibubi.create.content.contraptions.components.actors.dispenser;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.foundation.mixin.accessor.DispenserBlockAccessor;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
|
||||
|
@ -16,23 +14,26 @@ import net.minecraft.world.item.Item;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
||||
private static final HashMap<Item, IMovedDispenseItemBehaviour> MOVED_DISPENSE_ITEM_BEHAVIOURS = new HashMap<>();
|
||||
private static final HashMap<Item, IMovedDispenseItemBehaviour> MOVED_PROJECTILE_DISPENSE_BEHAVIOURS = new HashMap<>();
|
||||
private static final DispenserLookup BEHAVIOUR_LOOKUP = new DispenserLookup();
|
||||
private static boolean spawneggsRegistered = false;
|
||||
|
||||
public static void gatherMovedDispenseItemBehaviours() {
|
||||
IMovedDispenseItemBehaviour.init();
|
||||
}
|
||||
|
||||
public static void registerMovedDispenseItemBehaviour(Item item, IMovedDispenseItemBehaviour movedDispenseItemBehaviour) {
|
||||
public static void registerMovedDispenseItemBehaviour(Item item,
|
||||
IMovedDispenseItemBehaviour movedDispenseItemBehaviour) {
|
||||
MOVED_DISPENSE_ITEM_BEHAVIOURS.put(item, movedDispenseItemBehaviour);
|
||||
}
|
||||
|
||||
public static DispenseItemBehavior getDispenseMethod(ItemStack itemstack) {
|
||||
return ((DispenserBlockAccessor) Blocks.DISPENSER).create$callGetDispenseMethod(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void activate(MovementContext context, BlockPos pos) {
|
||||
if (!spawneggsRegistered) {
|
||||
|
@ -59,7 +60,7 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
|||
return;
|
||||
}
|
||||
|
||||
DispenseItemBehavior idispenseitembehavior = BEHAVIOUR_LOOKUP.getDispenseMethod(itemstack);
|
||||
DispenseItemBehavior idispenseitembehavior = getDispenseMethod(itemstack);
|
||||
if (idispenseitembehavior instanceof AbstractProjectileDispenseBehavior) { // Projectile behaviours can be converted most of the time
|
||||
IMovedDispenseItemBehaviour iMovedDispenseItemBehaviour = MovedProjectileDispenserBehaviour.of((AbstractProjectileDispenseBehavior) idispenseitembehavior);
|
||||
setItemStackAt(location, iMovedDispenseItemBehaviour.dispense(itemstack, context, pos), context);
|
||||
|
@ -85,15 +86,4 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
|||
}
|
||||
}
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
private static class DispenserLookup extends DispenserBlock {
|
||||
protected DispenserLookup() {
|
||||
super(BlockBehaviour.Properties.copy(Blocks.DISPENSER));
|
||||
}
|
||||
|
||||
public DispenseItemBehavior getDispenseMethod(ItemStack itemStack) {
|
||||
return super.getDispenseMethod(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllTags.AllBlockTags;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.actors.AttachedActorBlock;
|
||||
import com.simibubi.create.content.contraptions.components.actors.HarvesterBlock;
|
||||
import com.simibubi.create.content.contraptions.components.actors.PloughBlock;
|
||||
|
@ -36,7 +35,6 @@ import com.simibubi.create.foundation.config.ContraptionMovementSetting;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.BasePressurePlateBlock;
|
||||
import net.minecraft.world.level.block.BaseRailBlock;
|
||||
|
@ -75,7 +73,6 @@ public class BlockMovementChecks {
|
|||
private static final List<BrittleCheck> BRITTLE_CHECKS = new ArrayList<>();
|
||||
private static final List<AttachedCheck> ATTACHED_CHECKS = new ArrayList<>();
|
||||
private static final List<NotSupportiveCheck> NOT_SUPPORTIVE_CHECKS = new ArrayList<>();
|
||||
public static final ResourceLocation NON_MOVABLE = Create.asResource("non_movable");
|
||||
|
||||
// Registration
|
||||
// Add new checks to the front instead of the end
|
||||
|
@ -194,7 +191,7 @@ public class BlockMovementChecks {
|
|||
return true;
|
||||
if (state.getDestroySpeed(world, pos) == -1)
|
||||
return false;
|
||||
if (state.getBlock().getTags().contains(NON_MOVABLE))
|
||||
if (AllBlockTags.RELOCATION_NOT_SUPPORTED.matches(state))
|
||||
return false;
|
||||
if (ContraptionMovementSetting.get(state.getBlock()) == ContraptionMovementSetting.UNMOVABLE)
|
||||
return false;
|
||||
|
@ -255,7 +252,7 @@ public class BlockMovementChecks {
|
|||
return true;
|
||||
if (block instanceof WoolCarpetBlock)
|
||||
return true;
|
||||
return AllBlockTags.BRITTLE.tag.contains(block);
|
||||
return AllBlockTags.BRITTLE.matches(block);
|
||||
}
|
||||
|
||||
private static boolean isBlockAttachedTowardsFallback(BlockState state, Level world, BlockPos pos,
|
||||
|
|
|
@ -56,6 +56,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class InWorldProcessing {
|
||||
|
||||
|
@ -292,8 +293,8 @@ public class InWorldProcessing {
|
|||
}
|
||||
if (entity.isOnFire()) {
|
||||
entity.clearFire();
|
||||
level.playSound(null, entity.blockPosition(), SoundEvents.GENERIC_EXTINGUISH_FIRE, SoundSource.NEUTRAL,
|
||||
0.7F, 1.6F + (level.random.nextFloat() - level.random.nextFloat()) * 0.4F);
|
||||
level.playSound(null, entity.blockPosition(), SoundEvents.GENERIC_EXTINGUISH_FIRE,
|
||||
SoundSource.NEUTRAL, 0.7F, 1.6F + (level.random.nextFloat() - level.random.nextFloat()) * 0.4F);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,14 +468,20 @@ public class InWorldProcessing {
|
|||
if (block == Blocks.SOUL_FIRE
|
||||
|| block == Blocks.SOUL_CAMPFIRE && blockState.getOptionalValue(CampfireBlock.LIT)
|
||||
.orElse(false)
|
||||
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState) && blockState.getOptionalValue(LitBlazeBurnerBlock.FLAME_TYPE)
|
||||
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.SOUL).orElse(false))
|
||||
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState)
|
||||
&& blockState.getOptionalValue(LitBlazeBurnerBlock.FLAME_TYPE)
|
||||
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.SOUL)
|
||||
.orElse(false))
|
||||
return Type.HAUNTING;
|
||||
if (block == Blocks.FIRE
|
||||
|| BlockTags.CAMPFIRES.contains(block) && blockState.getOptionalValue(CampfireBlock.LIT)
|
||||
if (block == Blocks.FIRE || ForgeRegistries.BLOCKS.getHolder(block)
|
||||
.map(h -> h.containsTag(BlockTags.CAMPFIRES))
|
||||
.orElse(false)
|
||||
&& blockState.getOptionalValue(CampfireBlock.LIT)
|
||||
.orElse(false)
|
||||
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState)
|
||||
&& blockState.getOptionalValue(LitBlazeBurnerBlock.FLAME_TYPE)
|
||||
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.REGULAR)
|
||||
.orElse(false)
|
||||
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState) && blockState.getOptionalValue(LitBlazeBurnerBlock.FLAME_TYPE)
|
||||
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.REGULAR).orElse(false)
|
||||
|| getHeatLevelOf(blockState) == BlazeBurnerBlock.HeatLevel.SMOULDERING)
|
||||
return Type.SMOKING;
|
||||
if (block == Blocks.LAVA || getHeatLevelOf(blockState).isAtLeast(BlazeBurnerBlock.HeatLevel.FADING))
|
||||
|
|
|
@ -82,6 +82,7 @@ import net.minecraftforge.client.IBlockRenderProperties;
|
|||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEntity>, ISpecialBlockItemRequirement {
|
||||
|
||||
|
@ -130,7 +131,8 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) {
|
||||
public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos,
|
||||
Player player) {
|
||||
return AllItems.BELT_CONNECTOR.asStack();
|
||||
}
|
||||
|
||||
|
@ -249,7 +251,9 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
boolean isWrench = AllItems.WRENCH.isIn(heldItem);
|
||||
boolean isConnector = AllItems.BELT_CONNECTOR.isIn(heldItem);
|
||||
boolean isShaft = AllBlocks.SHAFT.isIn(heldItem);
|
||||
boolean isDye = Tags.Items.DYES.contains(heldItem.getItem());
|
||||
boolean isDye = ForgeRegistries.ITEMS.getHolder(heldItem.getItem())
|
||||
.map(h -> h.containsTag(Tags.Items.DYES))
|
||||
.orElse(false);
|
||||
boolean hasWater = EmptyingByBasin.emptyItem(world, heldItem, true)
|
||||
.getFirst()
|
||||
.getFluid()
|
||||
|
@ -603,7 +607,8 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
|
||||
public static class RenderProperties extends ReducedDestroyEffects implements DestroyProgressRenderingHandler {
|
||||
@Override
|
||||
public boolean renderDestroyProgress(ClientLevel level, LevelRenderer renderer, int breakerId, BlockPos pos, int progress, BlockState blockState) {
|
||||
public boolean renderDestroyProgress(ClientLevel level, LevelRenderer renderer, int breakerId, BlockPos pos,
|
||||
int progress, BlockState blockState) {
|
||||
BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||
if (blockEntity instanceof BeltTileEntity belt) {
|
||||
for (BlockPos beltPos : BeltBlock.getBeltChain(level, belt.getController())) {
|
||||
|
|
|
@ -24,7 +24,6 @@ import net.minecraft.ChatFormatting;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -40,6 +39,7 @@ import net.minecraftforge.client.gui.ForgeIngameGui;
|
|||
import net.minecraftforge.client.gui.IIngameOverlay;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class BlueprintOverlayRenderer {
|
||||
|
||||
|
@ -280,8 +280,12 @@ public class BlueprintOverlayRenderer {
|
|||
ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0));
|
||||
if (fromNBT instanceof ItemAttribute.InTag) {
|
||||
ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT;
|
||||
TagKey<Item> itag = ItemTags.getAllTags()
|
||||
.getTag(inTag.tagName);
|
||||
TagKey<Item> itag = ForgeRegistries.ITEMS.tags()
|
||||
.getTagNames()
|
||||
.filter(tk -> tk.location()
|
||||
.equals(inTag.tagName))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (itag != null)
|
||||
return Ingredient.of(itag)
|
||||
.getItems();
|
||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraft.world.effect.MobEffect;
|
|||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.animal.Fox;
|
||||
import net.minecraft.world.entity.item.FallingBlockEntity;
|
||||
|
@ -147,7 +148,7 @@ public class BuiltinPotatoProjectileTypes {
|
|||
.knockback(0.1f)
|
||||
.renderTumbling()
|
||||
.soundPitch(1.1f)
|
||||
.onEntityHit(potion(MobEffects.MOVEMENT_SLOWDOWN, 2,160, true))
|
||||
.onEntityHit(potion(MobEffects.MOVEMENT_SLOWDOWN, 2, 160, true))
|
||||
.registerAndAssign(AllItems.HONEYED_APPLE.get()),
|
||||
|
||||
GOLDEN_APPLE = create("golden_apple").damage(1)
|
||||
|
@ -160,8 +161,7 @@ public class BuiltinPotatoProjectileTypes {
|
|||
Entity entity = ray.getEntity();
|
||||
Level world = entity.level;
|
||||
|
||||
if (!(entity instanceof ZombieVillager)
|
||||
|| !((ZombieVillager) entity).hasEffect(MobEffects.WEAKNESS))
|
||||
if (!(entity instanceof ZombieVillager) || !((ZombieVillager) entity).hasEffect(MobEffects.WEAKNESS))
|
||||
return foodEffects(Foods.GOLDEN_APPLE, false).test(ray);
|
||||
if (world.isClientSide)
|
||||
return false;
|
||||
|
@ -261,7 +261,8 @@ public class BuiltinPotatoProjectileTypes {
|
|||
|
||||
private static Predicate<EntityHitResult> setFire(int seconds) {
|
||||
return ray -> {
|
||||
ray.getEntity().setSecondsOnFire(seconds);
|
||||
ray.getEntity()
|
||||
.setSecondsOnFire(seconds);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
@ -294,8 +295,10 @@ public class BuiltinPotatoProjectileTypes {
|
|||
}
|
||||
|
||||
private static void applyEffect(LivingEntity entity, MobEffectInstance effect) {
|
||||
if (effect.getEffect().isInstantenous())
|
||||
effect.getEffect().applyInstantenousEffect(null, null, entity, effect.getDuration(), 1.0);
|
||||
if (effect.getEffect()
|
||||
.isInstantenous())
|
||||
effect.getEffect()
|
||||
.applyInstantenousEffect(null, null, entity, effect.getDuration(), 1.0);
|
||||
else
|
||||
entity.addEffect(effect);
|
||||
}
|
||||
|
@ -319,12 +322,14 @@ public class BuiltinPotatoProjectileTypes {
|
|||
BlockState blockState = world.getBlockState(hitPos);
|
||||
if (!blockState.canSustainPlant(world, hitPos, face, (IPlantable) cropBlock.get()))
|
||||
return false;
|
||||
world.setBlock(placePos, cropBlock.get().defaultBlockState(), 3);
|
||||
world.setBlock(placePos, cropBlock.get()
|
||||
.defaultBlockState(), 3);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
private static BiPredicate<LevelAccessor, BlockHitResult> placeBlockOnGround(IRegistryDelegate<? extends Block> block) {
|
||||
private static BiPredicate<LevelAccessor, BlockHitResult> placeBlockOnGround(
|
||||
IRegistryDelegate<? extends Block> block) {
|
||||
return (world, ray) -> {
|
||||
if (world.isClientSide())
|
||||
return true;
|
||||
|
@ -340,18 +345,23 @@ public class BuiltinPotatoProjectileTypes {
|
|||
return false;
|
||||
|
||||
if (face == Direction.UP) {
|
||||
world.setBlock(placePos, block.get().defaultBlockState(), 3);
|
||||
} else if (world instanceof Level) {
|
||||
world.setBlock(placePos, block.get()
|
||||
.defaultBlockState(), 3);
|
||||
} else if (world instanceof Level level) {
|
||||
double y = ray.getLocation().y - 0.5;
|
||||
if (!world.isEmptyBlock(placePos.above()))
|
||||
y = Math.min(y, placePos.getY());
|
||||
if (!world.isEmptyBlock(placePos.below()))
|
||||
y = Math.max(y, placePos.getY());
|
||||
|
||||
FallingBlockEntity falling = new FallingBlockEntity((Level) world, placePos.getX() + 0.5, y,
|
||||
placePos.getZ() + 0.5, block.get().defaultBlockState());
|
||||
falling.time = 1;
|
||||
world.addFreshEntity(falling);
|
||||
BlockState fallingState = block.get()
|
||||
.defaultBlockState();
|
||||
|
||||
FallingBlockEntity fallingBlockEntity = new FallingBlockEntity(EntityType.FALLING_BLOCK, level);
|
||||
fallingBlockEntity.setPos(placePos.getX() + 0.5, y, placePos.getZ() + 0.5);
|
||||
fallingBlockEntity.time = 1;
|
||||
fallingBlockEntity.blockState = fallingState;
|
||||
world.addFreshEntity(fallingBlockEntity);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -373,18 +383,23 @@ public class BuiltinPotatoProjectileTypes {
|
|||
double entityZ = livingEntity.getZ();
|
||||
|
||||
for (int teleportTry = 0; teleportTry < 16; ++teleportTry) {
|
||||
double teleportX = entityX + (livingEntity.getRandom().nextDouble() - 0.5D) * teleportDiameter;
|
||||
double teleportY = Mth.clamp(entityY + (livingEntity.getRandom().nextInt((int) teleportDiameter) - (int) (teleportDiameter / 2)), 0.0D, world.getHeight() - 1);
|
||||
double teleportZ = entityZ + (livingEntity.getRandom().nextDouble() - 0.5D) * teleportDiameter;
|
||||
double teleportX = entityX + (livingEntity.getRandom()
|
||||
.nextDouble() - 0.5D) * teleportDiameter;
|
||||
double teleportY = Mth.clamp(entityY + (livingEntity.getRandom()
|
||||
.nextInt((int) teleportDiameter) - (int) (teleportDiameter / 2)), 0.0D, world.getHeight() - 1);
|
||||
double teleportZ = entityZ + (livingEntity.getRandom()
|
||||
.nextDouble() - 0.5D) * teleportDiameter;
|
||||
|
||||
EntityTeleportEvent.ChorusFruit event = ForgeEventFactory.onChorusFruitTeleport(livingEntity, teleportX, teleportY, teleportZ);
|
||||
EntityTeleportEvent.ChorusFruit event =
|
||||
ForgeEventFactory.onChorusFruitTeleport(livingEntity, teleportX, teleportY, teleportZ);
|
||||
if (event.isCanceled())
|
||||
return false;
|
||||
if (livingEntity.randomTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true)) {
|
||||
if (livingEntity.isPassenger())
|
||||
livingEntity.stopRiding();
|
||||
|
||||
SoundEvent soundevent = livingEntity instanceof Fox ? SoundEvents.FOX_TELEPORT : SoundEvents.CHORUS_FRUIT_TELEPORT;
|
||||
SoundEvent soundevent =
|
||||
livingEntity instanceof Fox ? SoundEvents.FOX_TELEPORT : SoundEvents.CHORUS_FRUIT_TELEPORT;
|
||||
world.playSound(null, entityX, entityY, entityZ, soundevent, SoundSource.PLAYERS, 1.0F, 1.0F);
|
||||
livingEntity.playSound(soundevent, 1.0F, 1.0F);
|
||||
livingEntity.setDeltaMovement(Vec3.ZERO);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.palettes;
|
|||
import static com.simibubi.create.content.palettes.PaletteBlockPattern.STANDARD_RANGE;
|
||||
import static com.simibubi.create.content.palettes.PaletteBlockPattern.VANILLA_RANGE;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.simibubi.create.AllTags;
|
||||
|
@ -11,11 +12,11 @@ import com.simibubi.create.foundation.data.CreateRegistrate;
|
|||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public enum AllPaletteStoneTypes {
|
||||
|
||||
|
@ -81,7 +82,8 @@ public enum AllPaletteStoneTypes {
|
|||
NonNullSupplier<Block> baseBlock = paletteStoneVariants.factory.apply(registrate);
|
||||
paletteStoneVariants.baseBlock = baseBlock;
|
||||
String id = Lang.asId(paletteStoneVariants.name());
|
||||
paletteStoneVariants.materialTag = AllTags.tag(ItemTags::createOptional, Create.ID, "stone_types/" + id);
|
||||
paletteStoneVariants.materialTag = AllTags.tag(r -> ForgeRegistries.ITEMS.tags()
|
||||
.createOptionalTagKey(r, Collections.emptySet()), Create.ID, "stone_types/" + id);
|
||||
paletteStoneVariants.variants = new PalettesVariantEntry(id, paletteStoneVariants);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.simibubi.create.AllRecipeTypes;
|
|||
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.SetTag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
|
@ -62,7 +62,7 @@ public class MechanicalCraftingRecipeBuilder {
|
|||
/**
|
||||
* Adds a key to the recipe pattern.
|
||||
*/
|
||||
public MechanicalCraftingRecipeBuilder key(Character p_200469_1_, SetTag<Item> p_200469_2_) {
|
||||
public MechanicalCraftingRecipeBuilder key(Character p_200469_1_, TagKey<Item> p_200469_2_) {
|
||||
return this.key(p_200469_1_, Ingredient.of(p_200469_2_));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ import net.minecraft.core.Registry;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.SerializationTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.level.material.FlowingFluid;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public abstract class FluidIngredient implements Predicate<FluidStack> {
|
||||
|
||||
|
@ -207,8 +207,9 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
if (accepted.getFluid()
|
||||
.isSame(t.getFluid()))
|
||||
return true;
|
||||
return t.getFluid()
|
||||
.is(tag);
|
||||
return ForgeRegistries.FLUIDS.getHolder(t.getFluid())
|
||||
.map(h -> h.containsTag(tag))
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -230,22 +231,20 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
|
||||
@Override
|
||||
protected void readInternal(JsonObject json) {
|
||||
ResourceLocation id = new ResourceLocation(GsonHelper.getAsString(json, "fluidTag"));
|
||||
tag = SerializationTags.getInstance().getTagOrThrow(Registry.FLUID_REGISTRY, id, rl -> {
|
||||
return new JsonSyntaxException("Unknown fluid tag '" + rl + "'");
|
||||
});
|
||||
ResourceLocation resourcelocation = new ResourceLocation(GsonHelper.getAsString(json, "fluidTag"));
|
||||
tag = TagKey.create(Registry.FLUID_REGISTRY, resourcelocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeInternal(JsonObject json) {
|
||||
json.addProperty("fluidTag", SerializationTags.getInstance().getIdOrThrow(Registry.FLUID_REGISTRY, tag, () -> {
|
||||
return new IllegalStateException("Unknown fluid tag");
|
||||
}).toString());
|
||||
json.addProperty("fluidTag", tag.location()
|
||||
.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<FluidStack> determineMatchingFluidStacks() {
|
||||
return tag.getValues()
|
||||
return ForgeRegistries.FLUIDS.tags()
|
||||
.getTag(tag)
|
||||
.stream()
|
||||
.map(f -> {
|
||||
if (f instanceof FlowingFluid)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package com.simibubi.create.foundation.item;
|
||||
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.tags.ITagManager;
|
||||
|
||||
public class TagDependentIngredientItem extends Item {
|
||||
|
||||
private ResourceLocation tag;
|
||||
private TagKey<Item> tag;
|
||||
|
||||
public TagDependentIngredientItem(Properties properties, ResourceLocation tag) {
|
||||
public TagDependentIngredientItem(Properties properties, TagKey<Item> tag) {
|
||||
super(properties);
|
||||
this.tag = tag;
|
||||
}
|
||||
|
@ -24,9 +24,10 @@ public class TagDependentIngredientItem extends Item {
|
|||
}
|
||||
|
||||
public boolean shouldHide() {
|
||||
Tag<?> tag = ItemTags.getAllTags()
|
||||
.getTag(this.tag);
|
||||
return tag == null || tag.getValues()
|
||||
ITagManager<Item> tags = ForgeRegistries.ITEMS.tags();
|
||||
if (tags == null || !tags.isKnownTagName(tag))
|
||||
return false;
|
||||
return tags.getTag(tag)
|
||||
.isEmpty();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.simibubi.create.foundation.mixin.accessor;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import net.minecraft.core.dispenser.DispenseItemBehavior;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
|
||||
@Mixin(DispenserBlock.class)
|
||||
public interface DispenserBlockAccessor {
|
||||
@Invoker("getDispenseMethod")
|
||||
DispenseItemBehavior create$callGetDispenseMethod(ItemStack stack);
|
||||
}
|
|
@ -17,11 +17,14 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.FenceBlock;
|
||||
import net.minecraftforge.client.model.ItemMultiLayerBakedModel;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ValueBoxRenderer {
|
||||
|
||||
public static void renderItemIntoValueBox(ItemStack filter, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
public static void renderItemIntoValueBox(ItemStack filter, PoseStack ms, MultiBufferSource buffer, int light,
|
||||
int overlay) {
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance()
|
||||
.getItemRenderer();
|
||||
BakedModel modelWithOverrides = itemRenderer.getModel(filter, null, null, 0);
|
||||
boolean blockItem = modelWithOverrides.isGui3d() && !(modelWithOverrides instanceof ItemMultiLayerBakedModel);
|
||||
float scale = (!blockItem ? .5f : 1f) - 1 / 64f;
|
||||
|
@ -41,7 +44,9 @@ public class ValueBoxRenderer {
|
|||
return NUDGE;
|
||||
if (block instanceof FenceBlock)
|
||||
return NUDGE;
|
||||
if (BlockTags.BUTTONS.contains(block))
|
||||
if (ForgeRegistries.BLOCKS.getHolder(block)
|
||||
.map(h -> h.containsTag(BlockTags.BUTTONS))
|
||||
.orElse(false))
|
||||
return NUDGE;
|
||||
if (block == Blocks.END_ROD)
|
||||
return NUDGE;
|
||||
|
|
|
@ -3,10 +3,10 @@ package com.simibubi.create.foundation.worldgen;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.Pair;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
|
@ -14,7 +14,6 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.world.level.biome.Biome.BiomeCategory;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
|
@ -33,7 +32,8 @@ public class AllWorldFeatures {
|
|||
|
||||
//
|
||||
|
||||
public static final ConfigDrivenFeatureEntry ZINC_ORE = register("zinc_ore", 12, 8, OVERWORLD_BIOMES).between(-63, 70)
|
||||
public static final ConfigDrivenFeatureEntry ZINC_ORE =
|
||||
register("zinc_ore", 12, 8, OVERWORLD_BIOMES).between(-63, 70)
|
||||
.withBlocks(Couple.create(AllBlocks.ZINC_ORE, AllBlocks.DEEPSLATE_ZINC_ORE));
|
||||
|
||||
public static final ConfigDrivenFeatureEntry STRIATED_ORES_OVERWORLD =
|
||||
|
@ -72,10 +72,12 @@ public class AllWorldFeatures {
|
|||
.forEach(entry -> {
|
||||
String id = Create.ID + "_" + entry.getKey()
|
||||
.getPath();
|
||||
ConfigDrivenFeatureEntry value = entry.getValue();
|
||||
Pair<ConfiguredFeature<?, ?>, PlacedFeature> feature = value.getFeature();
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.getFirst());
|
||||
Registry.register(BuiltinRegistries.PLACED_FEATURE, id, feature.getSecond());
|
||||
ConfigDrivenFeatureEntry featureEntry = entry.getValue();
|
||||
featureEntry.configuredFeature = BuiltinRegistries.register(BuiltinRegistries.CONFIGURED_FEATURE, id,
|
||||
featureEntry.factory.apply(featureEntry));
|
||||
featureEntry.placedFeature =
|
||||
BuiltinRegistries.register(BuiltinRegistries.PLACED_FEATURE, id, new PlacedFeature(
|
||||
featureEntry.configuredFeature, ImmutableList.of(new ConfigDrivenDecorator(featureEntry.id))));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -84,10 +86,9 @@ public class AllWorldFeatures {
|
|||
Decoration decoStep = GenerationStep.Decoration.UNDERGROUND_ORES;
|
||||
ENTRIES.values()
|
||||
.forEach(entry -> {
|
||||
if (!entry.biomeFilter.test(event.getName(), event.getCategory()))
|
||||
return;
|
||||
generation.addFeature(decoStep, entry.getFeature()
|
||||
.getSecond());
|
||||
ConfigDrivenFeatureEntry value = entry;
|
||||
if (value.biomeFilter.test(event.getName(), event.getCategory()))
|
||||
generation.addFeature(decoStep, value.placedFeature);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,9 @@ public class ConfigDrivenDecorator extends PlacementModifier {
|
|||
|
||||
@Override
|
||||
public Stream<BlockPos> getPositions(PlacementContext context, Random random, BlockPos pos) {
|
||||
ConfigDrivenOreConfiguration config = (ConfigDrivenOreConfiguration) entry().getFeature()
|
||||
.getFirst().config;
|
||||
ConfigDrivenOreConfiguration config = (ConfigDrivenOreConfiguration) entry().configuredFeature.value()
|
||||
.config();
|
||||
|
||||
float frequency = config.getFrequency();
|
||||
int floored = Mth.floor(frequency);
|
||||
int count = floored + (random.nextFloat() < frequency - floored ? 1 : 0);
|
||||
|
|
|
@ -2,16 +2,15 @@ package com.simibubi.create.foundation.worldgen;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.config.ConfigBase;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.Pair;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.data.worldgen.features.OreFeatures;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
|
@ -37,7 +36,8 @@ public class ConfigDrivenFeatureEntry extends ConfigBase {
|
|||
protected ConfigFloat frequency;
|
||||
|
||||
Function<ConfigDrivenFeatureEntry, ? extends ConfiguredFeature<?, ?>> factory;
|
||||
Optional<Pair<ConfiguredFeature<?, ?>, PlacedFeature>> feature = Optional.empty();
|
||||
Holder<ConfiguredFeature<?, ?>> configuredFeature;
|
||||
Holder<PlacedFeature> placedFeature;
|
||||
|
||||
public ConfigDrivenFeatureEntry(String id, int clusterSize, float frequency) {
|
||||
this.id = id;
|
||||
|
@ -79,25 +79,17 @@ public class ConfigDrivenFeatureEntry extends ConfigBase {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Pair<ConfiguredFeature<?, ?>, PlacedFeature> getFeature() {
|
||||
if (!feature.isPresent()) {
|
||||
ConfiguredFeature<?, ?> configured = factory.apply(this);
|
||||
feature = Optional.of(Pair.of(configured, configured.placed(new ConfigDrivenDecorator(id))));
|
||||
}
|
||||
return feature.get();
|
||||
}
|
||||
|
||||
private ConfiguredFeature<?, ?> layersFactory(ConfigDrivenFeatureEntry entry) {
|
||||
ConfigDrivenOreConfiguration config = new ConfigDrivenOreConfiguration(ImmutableList.of(), 0, id);
|
||||
LayeredOreFeature.LAYER_PATTERNS.put(Create.asResource(id), layers.stream()
|
||||
.map(NonNullSupplier::get)
|
||||
.toList());
|
||||
return LayeredOreFeature.INSTANCE.configured(config);
|
||||
return new ConfiguredFeature<>(LayeredOreFeature.INSTANCE, config);
|
||||
}
|
||||
|
||||
private ConfiguredFeature<?, ?> standardFactory(ConfigDrivenFeatureEntry entry) {
|
||||
ConfigDrivenOreConfiguration config = new ConfigDrivenOreConfiguration(createTarget(), 0, id);
|
||||
return VanillaStyleOreFeature.INSTANCE.configured(config);
|
||||
return new ConfiguredFeature<>(VanillaStyleOreFeature.INSTANCE, config);
|
||||
}
|
||||
|
||||
private List<TargetBlockState> createTarget() {
|
||||
|
|
|
@ -6,6 +6,7 @@ protected net.minecraft.client.particle.Particle f_107205_ # stoppedByCollision
|
|||
public net.minecraft.client.renderer.ItemInHandRenderer f_109300_ # mainHandItem
|
||||
public net.minecraft.client.renderer.ItemInHandRenderer f_109301_ # offHandItem
|
||||
public net.minecraft.client.renderer.entity.ItemRenderer f_115096_ # textureManager
|
||||
public net.minecraft.world.entity.item.FallingBlockEntity f_31946_ # blockState
|
||||
|
||||
public-f net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket f_132663_ # flyingSpeed
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ license="MIT"
|
|||
|
||||
[[mods]]
|
||||
modId="create"
|
||||
version="0.4f"
|
||||
version="0.4.1"
|
||||
displayName="Create"
|
||||
#updateJSONURL=""
|
||||
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"
|
||||
|
@ -18,20 +18,20 @@ Technology that empowers the player.'''
|
|||
[[dependencies.create]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[39.0.46,)"
|
||||
versionRange="[40.0.0,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.create]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.18.1,1.19)"
|
||||
versionRange="[1.18.2,1.19)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.create]]
|
||||
modId="flywheel"
|
||||
mandatory=true
|
||||
versionRange="[1.18-0.6.1,1.18-0.6.2)"
|
||||
versionRange="[1.18-0.6.2,1.18-0.6.3)"
|
||||
ordering="AFTER"
|
||||
side="CLIENT"
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
"mixins": [
|
||||
"CustomItemUseEffectsMixin",
|
||||
"accessor.AbstractProjectileDispenseBehaviorAccessor",
|
||||
"accessor.LivingEntityAccessor"
|
||||
"accessor.LivingEntityAccessor",
|
||||
"accessor.DispenserBlockAccessor"
|
||||
],
|
||||
"client": [
|
||||
"DestroyProgressMixin",
|
||||
|
|
Loading…
Reference in a new issue