Tagging along
- Fix glowing shader for 1.18.2 - Optimize and compress tag code - Convert MovementBehaviour to interface - Remove manual refmap remapping as it is no longer necessary - Update Gradle
This commit is contained in:
parent
1525cbb14b
commit
b32c83e74d
47 changed files with 195 additions and 198 deletions
|
@ -48,8 +48,6 @@ minecraft {
|
|||
arg '-mixin.config=flywheel.mixins.json'
|
||||
//jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling
|
||||
property 'forge.logging.console.level', 'info'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
mods {
|
||||
create {
|
||||
source sourceSets.main
|
||||
|
@ -67,8 +65,6 @@ minecraft {
|
|||
workingDirectory project.file('run/server')
|
||||
arg '-mixin.config=create.mixins.json'
|
||||
property 'forge.logging.console.level', 'info'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
mods {
|
||||
create {
|
||||
source sourceSets.main
|
||||
|
@ -80,8 +76,6 @@ minecraft {
|
|||
workingDirectory project.file('run')
|
||||
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
args '--mod', 'create', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources')
|
||||
mods {
|
||||
create {
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
10
gradlew
vendored
10
gradlew
vendored
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -32,10 +32,10 @@
|
|||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
|
|
|
@ -253,7 +253,7 @@ public class AllItems {
|
|||
public static final ItemEntry<? extends CopperArmorItem>
|
||||
|
||||
COPPER_BACKTANK = REGISTRATE.item("copper_backtank", p -> new CopperBacktankItem(p, COPPER_BACKTANK_PLACEABLE))
|
||||
.model(AssetLookup.<CopperBacktankItem>customGenericItemModel("_", "item"))
|
||||
.model(AssetLookup.customGenericItemModel("_", "item"))
|
||||
.register(),
|
||||
|
||||
DIVING_HELMET = REGISTRATE.item("diving_helmet", DivingHelmetItem::new)
|
||||
|
|
|
@ -5,7 +5,6 @@ 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;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
@ -16,6 +15,8 @@ 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;
|
||||
|
@ -25,37 +26,36 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public class AllTags {
|
||||
|
||||
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
||||
.creativeModeTab(() -> Create.BASE_CREATIVE_TAB);
|
||||
|
||||
public static <T> TagKey<T> tag(Function<ResourceLocation, TagKey<T>> wrapperFactory, String namespace,
|
||||
String path) {
|
||||
return wrapperFactory.apply(new ResourceLocation(namespace, path));
|
||||
public static <T extends IForgeRegistryEntry<T>> TagKey<T> optionalTag(IForgeRegistry<T> registry, ResourceLocation id) {
|
||||
return registry.tags().createOptionalTagKey(id, Collections.emptySet());
|
||||
}
|
||||
|
||||
public static <T> TagKey<T> forgeTag(Function<ResourceLocation, TagKey<T>> wrapperFactory, String path) {
|
||||
return tag(wrapperFactory, "forge", path);
|
||||
public static <T extends IForgeRegistryEntry<T>> TagKey<T> forgeTag(IForgeRegistry<T> registry, String path) {
|
||||
return optionalTag(registry, new ResourceLocation("forge", path));
|
||||
}
|
||||
|
||||
public static TagKey<Block> forgeBlockTag(String path) {
|
||||
return forgeTag(r -> ForgeRegistries.BLOCKS.tags()
|
||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
||||
return forgeTag(ForgeRegistries.BLOCKS, path);
|
||||
}
|
||||
|
||||
public static TagKey<Item> forgeItemTag(String path) {
|
||||
return forgeTag(r -> ForgeRegistries.ITEMS.tags()
|
||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
||||
return forgeTag(ForgeRegistries.ITEMS, path);
|
||||
}
|
||||
|
||||
public static TagKey<Fluid> forgeFluidTag(String path) {
|
||||
return forgeTag(r -> ForgeRegistries.FLUIDS.tags()
|
||||
.createOptionalTagKey(r, Collections.emptySet()), path);
|
||||
return forgeTag(ForgeRegistries.FLUIDS, path);
|
||||
}
|
||||
|
||||
public static <T extends Block, P> NonNullFunction<BlockBuilder<T, P>, BlockBuilder<T, P>> axeOrPickaxe() {
|
||||
|
@ -85,7 +85,9 @@ 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,8 +121,8 @@ public class AllTags {
|
|||
WINDOWABLE,
|
||||
WRENCH_PICKUP,
|
||||
|
||||
WG_STONE(FORGE),
|
||||
RELOCATION_NOT_SUPPORTED(FORGE),
|
||||
WG_STONE(FORGE),
|
||||
|
||||
SLIMY_LOGS(TIC),
|
||||
|
||||
|
@ -147,24 +149,22 @@ 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 = ForgeRegistries.BLOCKS.tags()
|
||||
.createOptionalTagKey(id, Collections.emptySet());
|
||||
tag = optionalTag(ForgeRegistries.BLOCKS, id);
|
||||
} else {
|
||||
tag = TagKey.create(ForgeRegistries.BLOCKS.getRegistryKey(), id);
|
||||
tag = BlockTags.create(id);
|
||||
}
|
||||
if (alwaysDatagen) {
|
||||
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean matches(Block block) {
|
||||
return ForgeRegistries.BLOCKS.getHolder(block)
|
||||
.map(h -> h.containsTag(tag))
|
||||
.orElse(false);
|
||||
return block.builtInRegistryHolder().is(tag);
|
||||
}
|
||||
|
||||
public boolean matches(BlockState state) {
|
||||
return matches(state.getBlock());
|
||||
return state.is(tag);
|
||||
}
|
||||
|
||||
public void add(Block... values) {
|
||||
|
@ -226,20 +226,22 @@ 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 = ForgeRegistries.ITEMS.tags()
|
||||
.createOptionalTagKey(id, Collections.emptySet());
|
||||
tag = optionalTag(ForgeRegistries.ITEMS, id);
|
||||
} else {
|
||||
tag = TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), id);
|
||||
tag = ItemTags.create(id);
|
||||
}
|
||||
if (alwaysDatagen) {
|
||||
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean matches(Item item) {
|
||||
return item.builtInRegistryHolder().is(tag);
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
return ForgeRegistries.ITEMS.getHolder(stack.getItem())
|
||||
.map(h -> h.containsTag(tag))
|
||||
.orElse(false);
|
||||
return stack.is(tag);
|
||||
}
|
||||
|
||||
public void add(Item... values) {
|
||||
|
@ -293,19 +295,22 @@ 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 = ForgeRegistries.FLUIDS.tags()
|
||||
.createOptionalTagKey(id, Collections.emptySet());
|
||||
tag = optionalTag(ForgeRegistries.FLUIDS, id);
|
||||
} else {
|
||||
tag = TagKey.create(ForgeRegistries.FLUIDS.getRegistryKey(), id);
|
||||
tag = FluidTags.create(id);
|
||||
}
|
||||
if (alwaysDatagen)
|
||||
if (alwaysDatagen) {
|
||||
REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean matches(Fluid fluid) {
|
||||
return fluid != null && ForgeRegistries.FLUIDS.getHolder(fluid)
|
||||
.map(h -> h.containsTag(tag))
|
||||
.orElse(false);
|
||||
return fluid.is(tag);
|
||||
}
|
||||
|
||||
public boolean matches(FluidState state) {
|
||||
return state.is(tag);
|
||||
}
|
||||
|
||||
public void add(Fluid... values) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class BellMovementBehaviour extends MovementBehaviour {
|
||||
public class BellMovementBehaviour implements MovementBehaviour {
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalTileEntity() {
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class BlockBreakingMovementBehaviour extends MovementBehaviour {
|
||||
public class BlockBreakingMovementBehaviour implements MovementBehaviour {
|
||||
|
||||
@Override
|
||||
public void startMoving(MovementContext context) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
|||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.level.block.CampfireBlock;
|
||||
|
||||
public class CampfireMovementBehaviour extends MovementBehaviour {
|
||||
public class CampfireMovementBehaviour implements MovementBehaviour {
|
||||
@Override
|
||||
public boolean renderAsNormalTileEntity() {
|
||||
return true;
|
||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.world.level.block.state.properties.Property;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
public class HarvesterMovementBehaviour extends MovementBehaviour {
|
||||
public class HarvesterMovementBehaviour implements MovementBehaviour {
|
||||
|
||||
@Override
|
||||
public boolean isActive(MovementContext context) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class PortableStorageInterfaceMovement extends MovementBehaviour {
|
||||
public class PortableStorageInterfaceMovement implements MovementBehaviour {
|
||||
|
||||
static final String _workingPos_ = "WorkingPos";
|
||||
static final String _clientPrevPos_ = "ClientPrevPos";
|
||||
|
|
|
@ -17,11 +17,11 @@ import net.minecraft.world.level.block.state.properties.SlabType;
|
|||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class SeatMovementBehaviour extends MovementBehaviour {
|
||||
public class SeatMovementBehaviour implements MovementBehaviour {
|
||||
|
||||
@Override
|
||||
public void startMoving(MovementContext context) {
|
||||
super.startMoving(context);
|
||||
MovementBehaviour.super.startMoving(context);
|
||||
int indexOf = context.contraption.getSeats()
|
||||
.indexOf(context.localPos);
|
||||
context.data.putInt("SeatIndex", indexOf);
|
||||
|
@ -29,7 +29,7 @@ public class SeatMovementBehaviour extends MovementBehaviour {
|
|||
|
||||
@Override
|
||||
public void visitNewPosition(MovementContext context, BlockPos pos) {
|
||||
super.visitNewPosition(context, pos);
|
||||
MovementBehaviour.super.visitNewPosition(context, pos);
|
||||
|
||||
AbstractContraptionEntity contraptionEntity = context.contraption.entity;
|
||||
if (contraptionEntity == null)
|
||||
|
|
|
@ -19,7 +19,7 @@ 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 boolean spawneggsRegistered = false;
|
||||
private static boolean spawnEggsRegistered = false;
|
||||
|
||||
public static void gatherMovedDispenseItemBehaviours() {
|
||||
IMovedDispenseItemBehaviour.init();
|
||||
|
@ -36,35 +36,35 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
|||
|
||||
@Override
|
||||
protected void activate(MovementContext context, BlockPos pos) {
|
||||
if (!spawneggsRegistered) {
|
||||
spawneggsRegistered = true;
|
||||
IMovedDispenseItemBehaviour.initSpawneggs();
|
||||
if (!spawnEggsRegistered) {
|
||||
spawnEggsRegistered = true;
|
||||
IMovedDispenseItemBehaviour.initSpawnEggs();
|
||||
}
|
||||
|
||||
DispenseItemLocation location = getDispenseLocation(context);
|
||||
if (location.isEmpty()) {
|
||||
context.world.levelEvent(1001, pos, 0);
|
||||
} else {
|
||||
ItemStack itemstack = getItemStackAt(location, context);
|
||||
ItemStack itemStack = getItemStackAt(location, context);
|
||||
// Special dispense item behaviour for moving contraptions
|
||||
if (MOVED_DISPENSE_ITEM_BEHAVIOURS.containsKey(itemstack.getItem())) {
|
||||
setItemStackAt(location, MOVED_DISPENSE_ITEM_BEHAVIOURS.get(itemstack.getItem()).dispense(itemstack, context, pos), context);
|
||||
if (MOVED_DISPENSE_ITEM_BEHAVIOURS.containsKey(itemStack.getItem())) {
|
||||
setItemStackAt(location, MOVED_DISPENSE_ITEM_BEHAVIOURS.get(itemStack.getItem()).dispense(itemStack, context, pos), context);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack backup = itemstack.copy();
|
||||
ItemStack backup = itemStack.copy();
|
||||
// If none is there, try vanilla registry
|
||||
try {
|
||||
if (MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.containsKey(itemstack.getItem())) {
|
||||
setItemStackAt(location, MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.get(itemstack.getItem()).dispense(itemstack, context, pos), context);
|
||||
if (MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.containsKey(itemStack.getItem())) {
|
||||
setItemStackAt(location, MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.get(itemStack.getItem()).dispense(itemStack, context, pos), context);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.put(itemstack.getItem(), iMovedDispenseItemBehaviour); // buffer conversion if successful
|
||||
DispenseItemBehavior behavior = getDispenseMethod(itemStack);
|
||||
if (behavior instanceof AbstractProjectileDispenseBehavior) { // Projectile behaviours can be converted most of the time
|
||||
IMovedDispenseItemBehaviour movedBehaviour = MovedProjectileDispenserBehaviour.of((AbstractProjectileDispenseBehavior) behavior);
|
||||
setItemStackAt(location, movedBehaviour.dispense(itemStack, context, pos), context);
|
||||
MOVED_PROJECTILE_DISPENSE_BEHAVIOURS.put(itemStack.getItem(), movedBehaviour); // buffer conversion if successful
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -74,15 +74,15 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
|||
Direction clostestFacing = Direction.getNearest(facingVec.x, facingVec.y, facingVec.z);
|
||||
ContraptionBlockSource blockSource = new ContraptionBlockSource(context, pos, clostestFacing);
|
||||
|
||||
if (idispenseitembehavior.getClass() != DefaultDispenseItemBehavior.class) { // There is a dispense item behaviour registered for the vanilla dispenser
|
||||
setItemStackAt(location, idispenseitembehavior.dispense(blockSource, itemstack), context);
|
||||
if (behavior.getClass() != DefaultDispenseItemBehavior.class) { // There is a dispense item behaviour registered for the vanilla dispenser
|
||||
setItemStackAt(location, behavior.dispense(blockSource, itemStack), context);
|
||||
return;
|
||||
}
|
||||
} catch (NullPointerException ignored) {
|
||||
itemstack = backup; // Something went wrong with the TE being null in ContraptionBlockSource, reset the stack
|
||||
itemStack = backup; // Something went wrong with the TE being null in ContraptionBlockSource, reset the stack
|
||||
}
|
||||
|
||||
setItemStackAt(location, defaultBehaviour.dispense(itemstack, context, pos), context); // the default: launch the item
|
||||
setItemStackAt(location, DEFAULT_BEHAVIOUR.dispense(itemStack, context, pos), context); // the default: launch the item
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ import net.minecraft.world.ContainerHelper;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
public class DropperMovementBehaviour extends MovementBehaviour {
|
||||
protected static final MovedDefaultDispenseItemBehaviour defaultBehaviour = new MovedDefaultDispenseItemBehaviour();
|
||||
public class DropperMovementBehaviour implements MovementBehaviour {
|
||||
protected static final MovedDefaultDispenseItemBehaviour DEFAULT_BEHAVIOUR = new MovedDefaultDispenseItemBehaviour();
|
||||
private static final Random RNG = new Random();
|
||||
|
||||
protected void activate(MovementContext context, BlockPos pos) {
|
||||
|
@ -23,7 +23,7 @@ public class DropperMovementBehaviour extends MovementBehaviour {
|
|||
if (location.isEmpty()) {
|
||||
context.world.levelEvent(1001, pos, 0);
|
||||
} else {
|
||||
setItemStackAt(location, defaultBehaviour.dispense(getItemStackAt(location, context), context, pos), context);
|
||||
setItemStackAt(location, DEFAULT_BEHAVIOUR.dispense(getItemStackAt(location, context), context, pos), context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class DropperMovementBehaviour extends MovementBehaviour {
|
|||
|
||||
@Override
|
||||
public void stopMoving(MovementContext context) {
|
||||
super.stopMoving(context);
|
||||
MovementBehaviour.super.stopMoving(context);
|
||||
writeExtraData(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
|
||||
public interface IMovedDispenseItemBehaviour {
|
||||
|
||||
static void initSpawneggs() {
|
||||
static void initSpawnEggs() {
|
||||
final IMovedDispenseItemBehaviour spawnEggDispenseBehaviour = new MovedDefaultDispenseItemBehaviour() {
|
||||
@Override
|
||||
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3 facing) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBehaviour {
|
||||
private static final MovedDefaultDispenseItemBehaviour defaultInstance = new MovedDefaultDispenseItemBehaviour();
|
||||
private static final MovedDefaultDispenseItemBehaviour DEFAULT_INSTANCE = new MovedDefaultDispenseItemBehaviour();
|
||||
|
||||
public static void doDispense(Level p_82486_0_, ItemStack p_82486_1_, int p_82486_2_, Vec3 facing, BlockPos p_82486_4_, MovementContext context) {
|
||||
double d0 = p_82486_4_.getX() + facing.x + .5;
|
||||
|
@ -87,7 +87,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
|
|||
consumedFrom.shrink(1);
|
||||
ItemStack remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, output.copy(), false);
|
||||
if (!remainder.isEmpty())
|
||||
defaultInstance.dispenseStack(output, context, pos, facing);
|
||||
DEFAULT_INSTANCE.dispenseStack(output, context, pos, facing);
|
||||
return consumedFrom;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,20 +145,19 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
|
||||
// Output Items
|
||||
if (facing != Direction.UP) {
|
||||
Direction inputDir = facing;
|
||||
BlockPos nextPos = worldPosition.offset(facing.getAxis() == Axis.X ? 1f * offset : 0f, (-1f),
|
||||
facing.getAxis() == Axis.Z ? 1f * offset : 0f);
|
||||
DirectBeltInputBehaviour behaviour =
|
||||
TileEntityBehaviour.get(level, nextPos, DirectBeltInputBehaviour.TYPE);
|
||||
if (behaviour != null) {
|
||||
boolean changed = false;
|
||||
if (!behaviour.canInsertFromSide(inputDir))
|
||||
if (!behaviour.canInsertFromSide(facing))
|
||||
return;
|
||||
for (int slot = 0; slot < inventory.getSlots(); slot++) {
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
if (stack.isEmpty())
|
||||
continue;
|
||||
ItemStack remainder = behaviour.handleInsertion(stack, inputDir, false);
|
||||
ItemStack remainder = behaviour.handleInsertion(stack, facing, false);
|
||||
if (remainder.equals(stack, false))
|
||||
continue;
|
||||
inventory.setStackInSlot(slot, remainder);
|
||||
|
|
|
@ -47,7 +47,7 @@ import net.minecraftforge.common.util.BlockSnapshot;
|
|||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||
public class DeployerMovementBehaviour implements MovementBehaviour {
|
||||
|
||||
@Override
|
||||
public Vec3 getActiveAreaOffset(MovementContext context) {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
return false;
|
||||
BlockState checkState = level.getBlockState(worldPosition.below());
|
||||
|
||||
if (!checkState.is(AllBlockTags.FAN_HEATERS.tag))
|
||||
if (!AllBlockTags.FAN_HEATERS.matches(checkState))
|
||||
return false;
|
||||
|
||||
if (checkState.hasProperty(BlazeBurnerBlock.HEAT_LEVEL) && !checkState.getValue(BlazeBurnerBlock.HEAT_LEVEL)
|
||||
|
|
|
@ -252,7 +252,7 @@ public class BlockMovementChecks {
|
|||
return true;
|
||||
if (block instanceof WoolCarpetBlock)
|
||||
return true;
|
||||
return AllBlockTags.BRITTLE.matches(block);
|
||||
return AllBlockTags.BRITTLE.matches(state);
|
||||
}
|
||||
|
||||
private static boolean isBlockAttachedTowardsFallback(BlockState state, Level world, BlockPos pos,
|
||||
|
|
|
@ -17,23 +17,26 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
public abstract class MovementBehaviour {
|
||||
public interface MovementBehaviour {
|
||||
|
||||
public boolean isActive(MovementContext context) {
|
||||
default boolean isActive(MovementContext context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void tick(MovementContext context) {}
|
||||
default void tick(MovementContext context) {
|
||||
}
|
||||
|
||||
public void startMoving(MovementContext context) {}
|
||||
default void startMoving(MovementContext context) {
|
||||
}
|
||||
|
||||
public void visitNewPosition(MovementContext context, BlockPos pos) {}
|
||||
default void visitNewPosition(MovementContext context, BlockPos pos) {
|
||||
}
|
||||
|
||||
public Vec3 getActiveAreaOffset(MovementContext context) {
|
||||
default Vec3 getActiveAreaOffset(MovementContext context) {
|
||||
return Vec3.ZERO;
|
||||
}
|
||||
|
||||
public void dropItem(MovementContext context, ItemStack stack) {
|
||||
default void dropItem(MovementContext context, ItemStack stack) {
|
||||
ItemStack remainder;
|
||||
if (AllConfigs.SERVER.kinetics.moveItemsToStorage.get())
|
||||
remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, stack, false);
|
||||
|
@ -49,32 +52,31 @@ public abstract class MovementBehaviour {
|
|||
context.world.addFreshEntity(itemEntity);
|
||||
}
|
||||
|
||||
public void stopMoving(MovementContext context) {
|
||||
|
||||
default void onSpeedChanged(MovementContext context, Vec3 oldMotion, Vec3 motion) {
|
||||
}
|
||||
|
||||
public void writeExtraData(MovementContext context) {
|
||||
|
||||
default void stopMoving(MovementContext context) {
|
||||
}
|
||||
|
||||
public boolean renderAsNormalTileEntity() {
|
||||
default void writeExtraData(MovementContext context) {
|
||||
}
|
||||
|
||||
default boolean renderAsNormalTileEntity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSpecialInstancedRendering() {
|
||||
default boolean hasSpecialInstancedRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
||||
ContraptionMatrices matrices, MultiBufferSource buffer) {}
|
||||
default void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
||||
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Nullable
|
||||
public ActorInstance createInstance(MaterialManager materialManager, VirtualRenderWorld simulationWorld, MovementContext context) {
|
||||
default ActorInstance createInstance(MaterialManager materialManager, VirtualRenderWorld simulationWorld, MovementContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onSpeedChanged(MovementContext context, Vec3 oldMotion, Vec3 motion) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class StabilizedBearingMovementBehaviour extends MovementBehaviour {
|
||||
public class StabilizedBearingMovementBehaviour implements MovementBehaviour {
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraftforge.client.model.data.ModelProperty;
|
|||
|
||||
public class FluidTankModel extends CTModel {
|
||||
|
||||
protected static ModelProperty<CullData> CULL_PROPERTY = new ModelProperty<>();
|
||||
protected static final ModelProperty<CullData> CULL_PROPERTY = new ModelProperty<>();
|
||||
|
||||
public static FluidTankModel standard(BakedModel originalModel) {
|
||||
return new FluidTankModel(originalModel, AllSpriteShifts.FLUID_TANK, AllSpriteShifts.COPPER_CASING);
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
public class BasinMovementBehaviour extends MovementBehaviour {
|
||||
public class BasinMovementBehaviour implements MovementBehaviour {
|
||||
public Map<String, ItemStackHandler> getOrReadInventory(MovementContext context) {
|
||||
Map<String, ItemStackHandler> map = new HashMap<>();
|
||||
map.put("InputItems", new ItemStackHandler(9));
|
||||
|
@ -29,7 +29,7 @@ public class BasinMovementBehaviour extends MovementBehaviour {
|
|||
|
||||
@Override
|
||||
public void tick(MovementContext context) {
|
||||
super.tick(context);
|
||||
MovementBehaviour.super.tick(context);
|
||||
if (context.temporaryData == null || (boolean) context.temporaryData) {
|
||||
Vec3 facingVec = context.rotation.apply(Vec3.atLowerCornerOf(Direction.UP.getNormal()));
|
||||
facingVec.normalize();
|
||||
|
|
|
@ -56,7 +56,6 @@ 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 {
|
||||
|
||||
|
@ -473,9 +472,7 @@ public class InWorldProcessing {
|
|||
.map(flame -> flame == LitBlazeBurnerBlock.FlameType.SOUL)
|
||||
.orElse(false))
|
||||
return Type.HAUNTING;
|
||||
if (block == Blocks.FIRE || ForgeRegistries.BLOCKS.getHolder(block)
|
||||
.map(h -> h.containsTag(BlockTags.CAMPFIRES))
|
||||
.orElse(false)
|
||||
if (block == Blocks.FIRE || blockState.is(BlockTags.CAMPFIRES)
|
||||
&& blockState.getOptionalValue(CampfireBlock.LIT)
|
||||
.orElse(false)
|
||||
|| AllBlocks.LIT_BLAZE_BURNER.has(blockState)
|
||||
|
|
|
@ -82,7 +82,6 @@ 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 {
|
||||
|
||||
|
@ -251,9 +250,7 @@ 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 = ForgeRegistries.ITEMS.getHolder(heldItem.getItem())
|
||||
.map(h -> h.containsTag(Tags.Items.DYES))
|
||||
.orElse(false);
|
||||
boolean isDye = heldItem.is(Tags.Items.DYES);
|
||||
boolean hasWater = EmptyingByBasin.emptyItem(world, heldItem, true)
|
||||
.getFirst()
|
||||
.getFluid()
|
||||
|
|
|
@ -17,7 +17,7 @@ public class BeltHelper {
|
|||
|
||||
public static boolean isItemUpright(ItemStack stack) {
|
||||
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)
|
||||
.isPresent() || stack.is(AllItemTags.UPRIGHT_ON_BELT.tag);
|
||||
.isPresent() || AllItemTags.UPRIGHT_ON_BELT.matches(stack);
|
||||
}
|
||||
|
||||
public static BeltTileEntity getSegmentTE(LevelAccessor world, BlockPos pos) {
|
||||
|
|
|
@ -11,12 +11,12 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
|||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.ParticleEngine;
|
||||
import net.minecraft.client.particle.SpriteSet;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
|
@ -61,7 +61,7 @@ public abstract class BasicParticleData<T extends Particle> implements ParticleO
|
|||
|
||||
@Override
|
||||
public String writeToString() {
|
||||
return Registry.PARTICLE_TYPE.getKey(getType()).toString();
|
||||
return ForgeRegistries.PARTICLE_TYPES.getKey(getType()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.core.NonNullList;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
|
@ -121,7 +122,7 @@ public class BlueprintItem extends Item {
|
|||
filterItem.getOrCreateTag()
|
||||
.putInt("WhitelistMode", WhitelistMode.WHITELIST_DISJ.ordinal());
|
||||
ListTag attributes = new ListTag();
|
||||
ItemAttribute at = new ItemAttribute.InTag(resourcelocation);
|
||||
ItemAttribute at = new ItemAttribute.InTag(ItemTags.create(resourcelocation));
|
||||
CompoundTag compoundNBT = new CompoundTag();
|
||||
at.serializeNBT(compoundNBT);
|
||||
compoundNBT.putBoolean("Inverted", false);
|
||||
|
|
|
@ -24,13 +24,11 @@ import net.minecraft.ChatFormatting;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
|
@ -40,6 +38,8 @@ import net.minecraftforge.client.gui.IIngameOverlay;
|
|||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.tags.ITag;
|
||||
import net.minecraftforge.registries.tags.ITagManager;
|
||||
|
||||
public class BlueprintOverlayRenderer {
|
||||
|
||||
|
@ -278,17 +278,20 @@ public class BlueprintOverlayRenderer {
|
|||
ListTag attributes = tag.getList("MatchedAttributes", net.minecraft.nbt.Tag.TAG_COMPOUND);
|
||||
if (whitelistMode == WhitelistMode.WHITELIST_DISJ && attributes.size() == 1) {
|
||||
ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0));
|
||||
if (fromNBT instanceof ItemAttribute.InTag) {
|
||||
ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT;
|
||||
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();
|
||||
if (fromNBT instanceof ItemAttribute.InTag inTag) {
|
||||
ITagManager<Item> tagManager = ForgeRegistries.ITEMS.tags();
|
||||
if (tagManager.isKnownTagName(inTag.tag)) {
|
||||
ITag<Item> taggedItems = tagManager.getTag(inTag.tag);
|
||||
if (!taggedItems.isEmpty()) {
|
||||
ItemStack[] stacks = new ItemStack[taggedItems.size()];
|
||||
int i = 0;
|
||||
for (Item item : taggedItems) {
|
||||
stacks[i] = new ItemStack(item);
|
||||
i++;
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.mojang.authlib.GameProfile;
|
|||
import com.mojang.datafixers.util.Pair;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.mixin.accessor.FallingBlockEntityAccessor;
|
||||
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -22,7 +23,6 @@ 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;
|
||||
|
@ -354,14 +354,10 @@ public class BuiltinPotatoProjectileTypes {
|
|||
if (!world.isEmptyBlock(placePos.below()))
|
||||
y = Math.max(y, placePos.getY());
|
||||
|
||||
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);
|
||||
FallingBlockEntity falling = FallingBlockEntityAccessor.create$callInit(level, placePos.getX() + 0.5, y,
|
||||
placePos.getZ() + 0.5, block.get().defaultBlockState());
|
||||
falling.time = 1;
|
||||
world.addFreshEntity(falling);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.world.phys.AABB;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
public class FunnelMovementBehaviour extends MovementBehaviour {
|
||||
public class FunnelMovementBehaviour implements MovementBehaviour {
|
||||
|
||||
private final boolean hasFilter;
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class FunnelMovementBehaviour extends MovementBehaviour {
|
|||
|
||||
@Override
|
||||
public void visitNewPosition(MovementContext context, BlockPos pos) {
|
||||
super.visitNewPosition(context, pos);
|
||||
MovementBehaviour.super.visitNewPosition(context, pos);
|
||||
|
||||
if (context.state.getValue(FunnelBlock.EXTRACTING))
|
||||
extract(context, pos);
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.ticks.TickPriority;
|
||||
|
||||
public class ContactMovementBehaviour extends MovementBehaviour {
|
||||
public class ContactMovementBehaviour implements MovementBehaviour {
|
||||
|
||||
@Override
|
||||
public Vec3 getActiveAreaOffset(MovementContext context) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.simibubi.create.foundation.utility.Lang;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
|
@ -50,14 +51,13 @@ import net.minecraftforge.fml.ModList;
|
|||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public interface ItemAttribute {
|
||||
|
||||
static List<ItemAttribute> types = new ArrayList<>();
|
||||
|
||||
static ItemAttribute standard = register(StandardTraits.DUMMY);
|
||||
static ItemAttribute inTag = register(new InTag(new ResourceLocation("dummy")));
|
||||
static ItemAttribute inTag = register(new InTag(ItemTags.LOGS));
|
||||
static ItemAttribute inItemGroup = register(new InItemGroup(CreativeModeTab.TAB_MISC));
|
||||
static ItemAttribute addedBy = register(new InItemGroup.AddedBy("dummy"));
|
||||
static ItemAttribute hasEnchant = register(EnchantAttribute.EMPTY);
|
||||
|
@ -232,27 +232,20 @@ public interface ItemAttribute {
|
|||
|
||||
public static class InTag implements ItemAttribute {
|
||||
|
||||
public ResourceLocation tagName;
|
||||
public TagKey<Item> tag;
|
||||
|
||||
public InTag(ResourceLocation tagName) {
|
||||
this.tagName = tagName;
|
||||
public InTag(TagKey<Item> tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean appliesTo(ItemStack stack) {
|
||||
return ForgeRegistries.ITEMS.getHolder(stack.getItem())
|
||||
.get()
|
||||
.tags()
|
||||
.anyMatch(t -> t.location()
|
||||
.equals(tagName));
|
||||
return stack.is(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemAttribute> listAttributesOf(ItemStack stack) {
|
||||
return ForgeRegistries.ITEMS.getHolder(stack.getItem())
|
||||
.get()
|
||||
.tags()
|
||||
.map(TagKey::location)
|
||||
return stack.getTags()
|
||||
.map(InTag::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
@ -264,18 +257,18 @@ public interface ItemAttribute {
|
|||
|
||||
@Override
|
||||
public Object[] getTranslationParameters() {
|
||||
return new Object[] { "#" + tagName.toString() };
|
||||
return new Object[] { "#" + tag.location() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(CompoundTag nbt) {
|
||||
nbt.putString("space", tagName.getNamespace());
|
||||
nbt.putString("path", tagName.getPath());
|
||||
nbt.putString("space", tag.location().getNamespace());
|
||||
nbt.putString("path", tag.location().getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemAttribute readNBT(CompoundTag nbt) {
|
||||
return new InTag(new ResourceLocation(nbt.getString("space"), nbt.getString("path")));
|
||||
return new InTag(ItemTags.create(new ResourceLocation(nbt.getString("space"), nbt.getString("path"))));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ 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;
|
||||
|
@ -82,8 +81,7 @@ public enum AllPaletteStoneTypes {
|
|||
NonNullSupplier<Block> baseBlock = paletteStoneVariants.factory.apply(registrate);
|
||||
paletteStoneVariants.baseBlock = baseBlock;
|
||||
String id = Lang.asId(paletteStoneVariants.name());
|
||||
paletteStoneVariants.materialTag = AllTags.tag(r -> ForgeRegistries.ITEMS.tags()
|
||||
.createOptionalTagKey(r, Collections.emptySet()), Create.ID, "stone_types/" + id);
|
||||
paletteStoneVariants.materialTag = AllTags.optionalTag(ForgeRegistries.ITEMS, Create.asResource("stone_types/" + id));
|
||||
paletteStoneVariants.variants = new PalettesVariantEntry(id, paletteStoneVariants);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ import com.google.gson.JsonObject;
|
|||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.level.material.FlowingFluid;
|
||||
|
@ -200,6 +200,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
|
||||
protected TagKey<Fluid> tag;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected boolean testInternal(FluidStack t) {
|
||||
if (tag == null)
|
||||
|
@ -207,9 +208,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
if (accepted.getFluid()
|
||||
.isSame(t.getFluid()))
|
||||
return true;
|
||||
return ForgeRegistries.FLUIDS.getHolder(t.getFluid())
|
||||
.map(h -> h.containsTag(tag))
|
||||
.orElse(false);
|
||||
return t.getFluid().is(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -231,8 +230,8 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
|
||||
@Override
|
||||
protected void readInternal(JsonObject json) {
|
||||
ResourceLocation resourcelocation = new ResourceLocation(GsonHelper.getAsString(json, "fluidTag"));
|
||||
tag = TagKey.create(Registry.FLUID_REGISTRY, resourcelocation);
|
||||
ResourceLocation name = new ResourceLocation(GsonHelper.getAsString(json, "fluidTag"));
|
||||
tag = FluidTags.create(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,11 +24,8 @@ public class TagDependentIngredientItem extends Item {
|
|||
}
|
||||
|
||||
public boolean shouldHide() {
|
||||
ITagManager<Item> tags = ForgeRegistries.ITEMS.tags();
|
||||
if (tags == null || !tags.isKnownTagName(tag))
|
||||
return false;
|
||||
return tags.getTag(tag)
|
||||
.isEmpty();
|
||||
ITagManager<Item> tagManager = ForgeRegistries.ITEMS.tags();
|
||||
return !tagManager.isKnownTagName(tag) || tagManager.getTag(tag).isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.simibubi.create.foundation.mixin.accessor;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import net.minecraft.world.entity.item.FallingBlockEntity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
@Mixin(FallingBlockEntity.class)
|
||||
public interface FallingBlockEntityAccessor {
|
||||
@Invoker("<init>")
|
||||
static FallingBlockEntity create$callInit(Level level, double x, double y, double z, BlockState state) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@ 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 {
|
||||
|
||||
|
@ -34,22 +33,21 @@ public class ValueBoxRenderer {
|
|||
itemRenderer.renderStatic(filter, TransformType.FIXED, light, overlay, ms, buffer, 0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static float customZOffset(Item item) {
|
||||
float NUDGE = -.1f;
|
||||
float nudge = -.1f;
|
||||
if (item instanceof FilterItem)
|
||||
return NUDGE;
|
||||
return nudge;
|
||||
if (item instanceof BlockItem) {
|
||||
Block block = ((BlockItem) item).getBlock();
|
||||
if (block instanceof AbstractShaftBlock)
|
||||
return NUDGE;
|
||||
return nudge;
|
||||
if (block instanceof FenceBlock)
|
||||
return NUDGE;
|
||||
if (ForgeRegistries.BLOCKS.getHolder(block)
|
||||
.map(h -> h.containsTag(BlockTags.BUTTONS))
|
||||
.orElse(false))
|
||||
return NUDGE;
|
||||
return nudge;
|
||||
if (block.builtInRegistryHolder().is(BlockTags.BUTTONS))
|
||||
return nudge;
|
||||
if (block == Blocks.END_ROD)
|
||||
return NUDGE;
|
||||
return nudge;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ public class DirectBeltInputBehaviour extends TileEntityBehaviour {
|
|||
return ItemHandlerHelper.insertItemStacked(lazy.orElse(null), inserted.stack.copy(), simulate);
|
||||
}
|
||||
|
||||
// TODO: verify that this side is consistent across all calls
|
||||
public boolean canInsertFromSide(Direction side) {
|
||||
return canInsert.test(side);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ 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
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
modLoader="javafml"
|
||||
loaderVersion="[38,)"
|
||||
loaderVersion="[40,)"
|
||||
issueTrackerURL="https://github.com/Creators-of-Create/Create/issues"
|
||||
license="MIT"
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ uniform vec4 ColorModulator;
|
|||
uniform float FogStart;
|
||||
uniform float FogEnd;
|
||||
uniform vec4 FogColor;
|
||||
uniform float GameTime;
|
||||
|
||||
in float vertexDistance;
|
||||
in vec4 vertexColor;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
|
||||
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
|
||||
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
|
||||
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
|
||||
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ uniform sampler2D Sampler2;
|
|||
uniform mat4 ModelViewMat;
|
||||
uniform mat4 ProjMat;
|
||||
uniform mat3 IViewRotMat;
|
||||
uniform int FogShape;
|
||||
|
||||
out float vertexDistance;
|
||||
out vec4 vertexColor;
|
||||
|
@ -26,7 +27,7 @@ out vec4 normal;
|
|||
void main() {
|
||||
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
|
||||
|
||||
vertexDistance = cylindrical_distance(ModelViewMat, IViewRotMat * Position);
|
||||
vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
|
||||
vertexColor = Color;
|
||||
lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
|
||||
texCoord0 = UV0;
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
"mixins": [
|
||||
"CustomItemUseEffectsMixin",
|
||||
"accessor.AbstractProjectileDispenseBehaviorAccessor",
|
||||
"accessor.LivingEntityAccessor",
|
||||
"accessor.DispenserBlockAccessor"
|
||||
"accessor.DispenserBlockAccessor",
|
||||
"accessor.FallingBlockEntityAccessor",
|
||||
"accessor.LivingEntityAccessor"
|
||||
],
|
||||
"client": [
|
||||
"DestroyProgressMixin",
|
||||
|
|
Loading…
Reference in a new issue