mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Merge branch 'mc1.15/dev' of https://github.com/Creators-of-Create/Create into mc1.15/dev
This commit is contained in:
commit
afe2c4497d
25 changed files with 257 additions and 172 deletions
|
@ -1587,7 +1587,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
|
|||
9f9455ccb5fc9e3cbfce73862b46078346a522a5 assets/create/models/item/zinc_nugget.json
|
||||
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
|
||||
e76041b7ae829fdd7dc0524f6ca4d2f89fca51bb assets/create/sounds.json
|
||||
cb9641eaf33211af46daf57241c76733cf371ed2 data/create/advancements/aesthetics.json
|
||||
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
|
||||
187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json
|
||||
0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json
|
||||
356f4855a2a6c65be3fb51d7d1aabf2ca6034d42 data/create/advancements/arm_blaze_burner.json
|
||||
|
@ -1617,18 +1617,18 @@ d1fbc14303c7327e9fc02e505e7e434591b7f785 data/create/advancements/crushing_wheel
|
|||
77edd30e3d60b4d492662c673387910f66b5a276 data/create/advancements/dual_extendo_grip.json
|
||||
04eaf829696d735244c0e4798dd3bdeb26e13a32 data/create/advancements/electron_tube.json
|
||||
b78fe4e539fef1b3419f2eb4d1db47cb4a201992 data/create/advancements/extendo_grip.json
|
||||
4dbbf5f39441fdfe0561022ea7bbaa8e1f9733b7 data/create/advancements/fan.json
|
||||
9e2369129a52ffb4c67907ca5e81e342766f7867 data/create/advancements/fan_lava.json
|
||||
acef16596b7ae82aaf853142d69bcea7094b8173 data/create/advancements/fan_smoke.json
|
||||
36f72396d1b4ac9a89f4a9139fa10ed659f5954a data/create/advancements/fan_water.json
|
||||
b1699baaadaac7ebce642c09428519d156e21594 data/create/advancements/fan.json
|
||||
5aa76cba3b40a1c234ffa84a89ecca630990fc0f data/create/advancements/fan_lava.json
|
||||
716a9816558300a3652ed8d8d568517017813f5c data/create/advancements/fan_smoke.json
|
||||
a61eb63d02604e88836519f89f74b252a640d485 data/create/advancements/fan_water.json
|
||||
69e96e926a4d72e59cc6390c25f064166ddb62d2 data/create/advancements/fist_bump.json
|
||||
99ee1bf5390b9a4f2a2419c78f259ff5d2ab9ae9 data/create/advancements/flywheel.json
|
||||
489c58a0508a2a41cc0849dfb933eb5ac96ef364 data/create/advancements/glass_pipe.json
|
||||
62f3610188f7dbd3900ab305edc2d06282705a38 data/create/advancements/goggles.json
|
||||
10c8686da9cec2ae30c10f434836ac15a1b88666 data/create/advancements/hose_pulley.json
|
||||
a8595e5fdf6517e5c9c790afccc99fe9d3dd95aa data/create/advancements/infinite_chocolate.json
|
||||
50460d4470e9630b2d3ae1ec4f24d00d8d7c7e6b data/create/advancements/infinite_lava.json
|
||||
19d9794ac08cee962c7c718085d3e3ba5e89a328 data/create/advancements/infinite_water.json
|
||||
9f642faf92b75a28c564e90be8448b9a4328af5e data/create/advancements/infinite_chocolate.json
|
||||
a933fa5e7217e2ffe123ae035cfbc9210ba69fd5 data/create/advancements/infinite_lava.json
|
||||
a8ab0e4ffba358d23f9efaa9f51245b6d490a8be data/create/advancements/infinite_water.json
|
||||
9beb622c79e9f5ce2397c22222cac0faf272f388 data/create/advancements/integrated_circuit.json
|
||||
316bed3d8985d0a371200967d7edd2936f1b9f94 data/create/advancements/integrated_circuit_eob.json
|
||||
a80eea863bfdc7777b8bade39a81655b2f99e02f data/create/advancements/item_drain.json
|
||||
|
@ -1639,7 +1639,7 @@ a80eea863bfdc7777b8bade39a81655b2f99e02f data/create/advancements/item_drain.jso
|
|||
218568a4e416c5fa559c55a5c92aa4e93f88b837 data/create/advancements/mechanical_drill.json
|
||||
6dc84ad2f0512495fe3f01f99d3c547849351e33 data/create/advancements/mechanical_saw.json
|
||||
3bc549c06dc6d9568f92e1abc9654c9b4c33f035 data/create/advancements/millstone.json
|
||||
6f872e1e8be9d8e5fa378db1384b1de72fadac23 data/create/advancements/mixer.json
|
||||
238ac410eb4de16a82ae05cc16fef80e55a4b61b data/create/advancements/mixer.json
|
||||
325d4cef263ce301b143ee0498fb15afdb2c125b data/create/advancements/musical_arm.json
|
||||
c9c4060ed207226b69fada2d61e01a97d7077eae data/create/advancements/nixie_tube.json
|
||||
9329cb210a954c0de1dcf517e7dff1ece77c19c0 data/create/advancements/overstress_flywheel.json
|
||||
|
|
|
@ -149,8 +149,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "x",
|
||||
"sticky_north": "true"
|
||||
"sticky_north": "true",
|
||||
"axis": "x"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x_sticky"
|
||||
|
@ -158,8 +158,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "y",
|
||||
"sticky_north": "true"
|
||||
"sticky_north": "true",
|
||||
"axis": "y"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_y_sticky",
|
||||
|
@ -168,8 +168,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "z",
|
||||
"sticky_north": "true"
|
||||
"sticky_north": "true",
|
||||
"axis": "z"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x_sticky",
|
||||
|
@ -178,8 +178,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "x",
|
||||
"sticky_north": "false"
|
||||
"sticky_north": "false",
|
||||
"axis": "x"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x"
|
||||
|
@ -187,8 +187,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "y",
|
||||
"sticky_north": "false"
|
||||
"sticky_north": "false",
|
||||
"axis": "y"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_y",
|
||||
|
@ -197,8 +197,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "z",
|
||||
"sticky_north": "false"
|
||||
"sticky_north": "false",
|
||||
"axis": "z"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x",
|
||||
|
|
|
@ -17,13 +17,29 @@
|
|||
},
|
||||
"criteria": {
|
||||
"0": {
|
||||
"trigger": "create:bracket_shaft"
|
||||
"trigger": "create:bracket_apply",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"create:shaft"
|
||||
]
|
||||
}
|
||||
},
|
||||
"1": {
|
||||
"trigger": "create:bracket_cog"
|
||||
"trigger": "create:bracket_apply",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"create:cogwheel",
|
||||
"create:large_cogwheel"
|
||||
]
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"trigger": "create:bracket_pipe"
|
||||
"trigger": "create:bracket_apply",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"create:fluid_pipe"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
|
|
|
@ -17,7 +17,12 @@
|
|||
},
|
||||
"criteria": {
|
||||
"0": {
|
||||
"trigger": "create:fan"
|
||||
"trigger": "create:fan_processing",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"NONE"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
|
|
|
@ -17,7 +17,12 @@
|
|||
},
|
||||
"criteria": {
|
||||
"0": {
|
||||
"trigger": "create:fan_lava"
|
||||
"trigger": "create:fan_processing",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"BLASTING"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
|
|
|
@ -17,7 +17,12 @@
|
|||
},
|
||||
"criteria": {
|
||||
"0": {
|
||||
"trigger": "create:fan_smoke"
|
||||
"trigger": "create:fan_processing",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"SMOKING"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
|
|
|
@ -17,7 +17,12 @@
|
|||
},
|
||||
"criteria": {
|
||||
"0": {
|
||||
"trigger": "create:fan_water"
|
||||
"trigger": "create:fan_processing",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"SPLASHING"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
"0": {
|
||||
"trigger": "create:infinite_fluid",
|
||||
"conditions": {
|
||||
"registry_entry": "create:chocolate"
|
||||
"accepted_entries": [
|
||||
"create:chocolate"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
"0": {
|
||||
"trigger": "create:infinite_fluid",
|
||||
"conditions": {
|
||||
"registry_entry": "minecraft:lava"
|
||||
"accepted_entries": [
|
||||
"minecraft:lava"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
"0": {
|
||||
"trigger": "create:infinite_fluid",
|
||||
"conditions": {
|
||||
"registry_entry": "minecraft:water"
|
||||
"accepted_entries": [
|
||||
"minecraft:water"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -23,12 +23,6 @@
|
|||
}
|
||||
},
|
||||
"1": {
|
||||
"trigger": "create:kinetic_block",
|
||||
"conditions": {
|
||||
"registry_entry": "create:mechanical_mixer"
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"trigger": "create:mixer"
|
||||
}
|
||||
},
|
||||
|
@ -38,9 +32,6 @@
|
|||
],
|
||||
[
|
||||
"1"
|
||||
],
|
||||
[
|
||||
"2"
|
||||
]
|
||||
]
|
||||
}
|
|
@ -173,10 +173,6 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
boolean directionSwap = !fromOrToZero && Math.signum(previousSpeed) != Math.signum(getSpeed());
|
||||
if (fromOrToZero || directionSwap)
|
||||
flickerTally = getFlickerScore() + 5;
|
||||
|
||||
if (fromOrToZero && previousSpeed == 0 && !world.isRemote)
|
||||
AllTriggers.getPlayersInRange(world, pos, 4)
|
||||
.forEach(p -> AllTriggers.KINETIC_BLOCK.trigger(p, getBlockState().getBlock()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -114,9 +114,10 @@ public class AirCurrent {
|
|||
|
||||
entityDistance -= .5f;
|
||||
InWorldProcessing.Type processingType = getSegmentAt((float) entityDistance);
|
||||
if (processingType == null) {
|
||||
if (entity instanceof ServerPlayerEntity)
|
||||
AllTriggers.triggerFor(AllTriggers.FAN, (PlayerEntity) entity);
|
||||
if (entity instanceof ServerPlayerEntity)
|
||||
AllTriggers.triggerFor(AllTriggers.FAN_PROCESSING.constructTriggerFor(processingType), (PlayerEntity) entity);
|
||||
|
||||
if (processingType == null || processingType == Type.NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -139,24 +140,18 @@ public class AirCurrent {
|
|||
entity.setFire(10);
|
||||
entity.attackEntityFrom(damageSourceLava, 4);
|
||||
}
|
||||
if (entity instanceof ServerPlayerEntity)
|
||||
AllTriggers.triggerFor(AllTriggers.FAN_LAVA, (PlayerEntity) entity);
|
||||
break;
|
||||
case SMOKING:
|
||||
if (!entity.isImmuneToFire()) {
|
||||
entity.setFire(2);
|
||||
entity.attackEntityFrom(damageSourceFire, 2);
|
||||
}
|
||||
if (entity instanceof ServerPlayerEntity)
|
||||
AllTriggers.triggerFor(AllTriggers.FAN_SMOKE, (PlayerEntity) entity);
|
||||
break;
|
||||
case SPLASHING:
|
||||
if (entity instanceof EndermanEntity || entity.getType() == EntityType.SNOW_GOLEM
|
||||
|| entity.getType() == EntityType.BLAZE) {
|
||||
entity.attackEntityFrom(DamageSource.DROWN, 2);
|
||||
}
|
||||
if (entity instanceof ServerPlayerEntity)
|
||||
AllTriggers.triggerFor(AllTriggers.FAN_WATER, (PlayerEntity) entity);
|
||||
if (!entity.isBurning())
|
||||
break;
|
||||
entity.extinguish();
|
||||
|
@ -193,7 +188,7 @@ public class AirCurrent {
|
|||
AirCurrentSegment currentSegment = new AirCurrentSegment();
|
||||
segments.clear();
|
||||
currentSegment.startOffset = 0;
|
||||
InWorldProcessing.Type type = null;
|
||||
InWorldProcessing.Type type = Type.NONE;
|
||||
|
||||
int limit = (int) (maxDistance + .5f);
|
||||
int searchStart = pushing ? 0 : limit;
|
||||
|
@ -203,7 +198,7 @@ public class AirCurrent {
|
|||
for (int i = searchStart; i * searchStep <= searchEnd * searchStep; i += searchStep) {
|
||||
BlockPos currentPos = start.offset(direction, i);
|
||||
InWorldProcessing.Type newType = InWorldProcessing.Type.byBlock(world, currentPos);
|
||||
if (newType != null)
|
||||
if (newType != Type.NONE)
|
||||
type = newType;
|
||||
if (currentSegment.type != type || currentSegment.startOffset == 0) {
|
||||
currentSegment.endOffset = i;
|
||||
|
@ -341,7 +336,7 @@ public class AirCurrent {
|
|||
continue;
|
||||
return airCurrentSegment.type;
|
||||
}
|
||||
return null;
|
||||
return InWorldProcessing.Type.NONE;
|
||||
}
|
||||
|
||||
public static class AirCurrentSegment {
|
||||
|
|
|
@ -132,16 +132,7 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour {
|
|||
AllTriggers.triggerForNearbyPlayers(AllTriggers.HOSE_PULLEY, world, tileEntity.getPos(), 8);
|
||||
|
||||
if (infinite) {
|
||||
Fluid stillFluid = FluidHelper.convertToStill(fluid);
|
||||
AllTriggers.getPlayersInRange(world, tileEntity.getPos(), 8)
|
||||
.forEach(p -> AllTriggers.INFINITE_FLUID.trigger(p, FluidHelper.convertToStill(stillFluid)));
|
||||
/*
|
||||
if (FluidHelper.isLava(fluid))
|
||||
AllTriggers.triggerForNearbyPlayers(AllTriggers.INFINITE_LAVA, world, tileEntity.getPos(), 8);
|
||||
if (FluidHelper.isWater(fluid))
|
||||
AllTriggers.triggerForNearbyPlayers(AllTriggers.INFINITE_WATER, world, tileEntity.getPos(), 8);
|
||||
if (fluid.isEquivalentTo(AllFluids.CHOCOLATE.get()))
|
||||
AllTriggers.triggerForNearbyPlayers(AllTriggers.INFINITE_CHOCOLATE, world, tileEntity.getPos(), 8);*/
|
||||
AllTriggers.triggerForNearbyPlayers(AllTriggers.INFINITE_FLUID.constructTriggerFor(FluidHelper.convertToStill(fluid)), world, tileEntity.getPos(), 8);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class FluidPipeTileEntity extends SmartTileEntity {
|
|||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
||||
behaviours.add(new StandardPipeFluidTransportBehaviour(this));
|
||||
behaviours.add(new BracketedTileEntityBehaviour(this, this::canHaveBracket)
|
||||
.withTrigger(state -> AllTriggers.BRACKET_PIPE));
|
||||
.withTrigger(state -> AllTriggers.BRACKET_APPLY_TRIGGER.constructTriggerFor(state.getBlock())));
|
||||
}
|
||||
|
||||
private boolean canHaveBracket(BlockState state) {
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package com.simibubi.create.content.contraptions.relays.elementary;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||
import com.simibubi.create.foundation.advancement.SimpleTrigger;
|
||||
import com.simibubi.create.foundation.advancement.ITriggerable;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
@ -20,6 +14,10 @@ import net.minecraft.nbt.CompoundNBT;
|
|||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class BracketedTileEntityBehaviour extends TileEntityBehaviour {
|
||||
|
||||
public static BehaviourType<BracketedTileEntityBehaviour> TYPE = new BehaviourType<>();
|
||||
|
@ -28,10 +26,10 @@ public class BracketedTileEntityBehaviour extends TileEntityBehaviour {
|
|||
private boolean reRender;
|
||||
|
||||
private Predicate<BlockState> pred;
|
||||
private Function<BlockState, SimpleTrigger> trigger;
|
||||
private Function<BlockState, ITriggerable> trigger;
|
||||
|
||||
public BracketedTileEntityBehaviour(SmartTileEntity te) {
|
||||
this(te, Predicates.alwaysTrue());
|
||||
this(te, state -> true);
|
||||
}
|
||||
|
||||
public BracketedTileEntityBehaviour(SmartTileEntity te, Predicate<BlockState> pred) {
|
||||
|
@ -40,7 +38,7 @@ public class BracketedTileEntityBehaviour extends TileEntityBehaviour {
|
|||
bracket = Optional.empty();
|
||||
}
|
||||
|
||||
public BracketedTileEntityBehaviour withTrigger(Function<BlockState, SimpleTrigger> trigger) {
|
||||
public BracketedTileEntityBehaviour withTrigger(Function<BlockState, ITriggerable> trigger) {
|
||||
this.trigger = trigger;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class SimpleKineticTileEntity extends KineticTileEntity {
|
|||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
||||
behaviours.add(
|
||||
new BracketedTileEntityBehaviour(this, state -> state.getBlock() instanceof AbstractShaftBlock).withTrigger(
|
||||
state -> state.getBlock() instanceof ShaftBlock ? AllTriggers.BRACKET_SHAFT : AllTriggers.BRACKET_COG));
|
||||
state -> AllTriggers.BRACKET_APPLY_TRIGGER.constructTriggerFor(state.getBlock())));
|
||||
super.addBehaviours(behaviours);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package com.simibubi.create.content.curiosities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.config.CRecipes;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
|
@ -13,7 +11,6 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
@ -21,7 +18,6 @@ import net.minecraft.particles.ParticleTypes;
|
|||
import net.minecraft.tileentity.BeaconTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
|
@ -152,10 +148,6 @@ public class ChromaticCompoundItem extends Item {
|
|||
data.putBoolean("FromLight", true);
|
||||
entity.setItem(newStack);
|
||||
|
||||
List<ServerPlayerEntity> players =
|
||||
world.getEntitiesWithinAABB(ServerPlayerEntity.class, new AxisAlignedBB(entity.getPosition()).grow(8));
|
||||
players.forEach(AllTriggers.ABSORBED_LIGHT::trigger);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class InWorldProcessing {
|
|||
public static SplashingInv splashingInv = new SplashingInv();
|
||||
|
||||
public enum Type {
|
||||
SMOKING, BLASTING, SPLASHING
|
||||
SMOKING, BLASTING, SPLASHING, NONE
|
||||
|
||||
;
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class InWorldProcessing {
|
|||
return Type.SMOKING;
|
||||
if (block == Blocks.LAVA || getHeatLevelOf(blockState).isAtLeast(BlazeBurnerBlock.HeatLevel.FADING))
|
||||
return Type.BLASTING;
|
||||
return null;
|
||||
return Type.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Set;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import net.minecraft.fluid.FlowingFluid;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
|
@ -64,9 +65,9 @@ public class AllAdvancements implements IDataProvider {
|
|||
|
||||
Advancement aesthetics =
|
||||
advancement("aesthetics", AllBlocks.WOODEN_BRACKET.get(), TaskType.NORMAL).withParent(andesite_alloy)
|
||||
.withCriterion("0", AllTriggers.BRACKET_SHAFT.instance())
|
||||
.withCriterion("1", AllTriggers.BRACKET_COG.instance())
|
||||
.withCriterion("2", AllTriggers.BRACKET_PIPE.instance())
|
||||
.withCriterion("0", AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.SHAFT.get()))
|
||||
.withCriterion("1", AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.COGWHEEL.get(), AllBlocks.LARGE_COGWHEEL.get()))
|
||||
.withCriterion("2", AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.FLUID_PIPE.get()))
|
||||
.register(t, id + ":aesthetics");
|
||||
|
||||
Advancement reinforced =
|
||||
|
@ -125,19 +126,19 @@ public class AllAdvancements implements IDataProvider {
|
|||
.register(t, id + ":press");
|
||||
|
||||
Advancement fan = advancement("fan", AllBlocks.ENCASED_FAN.get(), TaskType.NORMAL).withParent(press)
|
||||
.withCriterion("0", AllTriggers.FAN.instance())
|
||||
.withCriterion("0", AllTriggers.FAN_PROCESSING.forEntries(InWorldProcessing.Type.NONE))
|
||||
.register(t, id + ":fan");
|
||||
|
||||
Advancement fan_lava = advancement("fan_lava", Items.LAVA_BUCKET, TaskType.NORMAL).withParent(fan)
|
||||
.withCriterion("0", AllTriggers.FAN_LAVA.instance())
|
||||
.withCriterion("0", AllTriggers.FAN_PROCESSING.forEntries(InWorldProcessing.Type.BLASTING))
|
||||
.register(t, id + ":fan_lava");
|
||||
|
||||
Advancement fan_smoke = advancement("fan_smoke", Items.CAMPFIRE, TaskType.NORMAL).withParent(fan)
|
||||
.withCriterion("0", AllTriggers.FAN_SMOKE.instance())
|
||||
.withCriterion("0", AllTriggers.FAN_PROCESSING.forEntries(InWorldProcessing.Type.SMOKING))
|
||||
.register(t, id + ":fan_smoke");
|
||||
|
||||
Advancement fan_water = advancement("fan_water", Items.WATER_BUCKET, TaskType.NORMAL).withParent(fan)
|
||||
.withCriterion("0", AllTriggers.FAN_WATER.instance())
|
||||
.withCriterion("0", AllTriggers.FAN_PROCESSING.forEntries(InWorldProcessing.Type.SPLASHING))
|
||||
.register(t, id + ":fan_water");
|
||||
|
||||
Advancement rose_quartz =
|
||||
|
@ -160,8 +161,7 @@ public class AllAdvancements implements IDataProvider {
|
|||
|
||||
Advancement mixer = advancement("mixer", AllBlocks.MECHANICAL_MIXER.get(), TaskType.MILESTONE)
|
||||
.withCriterion("0", placeBlock(AllBlocks.MECHANICAL_MIXER.get()))
|
||||
.withCriterion("1", isPowered(AllBlocks.MECHANICAL_MIXER.get()))
|
||||
.withCriterion("2", AllTriggers.MIXER_MIX.instance())
|
||||
.withCriterion("1", AllTriggers.MIXER_MIX.instance())
|
||||
.withParent(basin)
|
||||
.register(t, id + ":mixer");
|
||||
|
||||
|
@ -496,12 +496,8 @@ public class AllAdvancements implements IDataProvider {
|
|||
return PlacedBlockTrigger.Instance.placedBlock(block);
|
||||
}
|
||||
|
||||
public RegistryTrigger.Instance<Block> isPowered(Block block) {
|
||||
return AllTriggers.KINETIC_BLOCK.forEntry(block);
|
||||
}
|
||||
|
||||
public RegistryTrigger.Instance<Fluid> isInfinite(FlowingFluid fluid) {
|
||||
return AllTriggers.INFINITE_FLUID.forEntry(fluid.getStillFluid());
|
||||
return AllTriggers.INFINITE_FLUID.forEntries(fluid.getStillFluid());
|
||||
}
|
||||
|
||||
public InventoryChangeTrigger.Instance itemGathered(IItemProvider itemprovider) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -17,8 +18,9 @@ public class AllTriggers {
|
|||
|
||||
private static final List<CriterionTriggerBase<?>> triggers = new LinkedList<>();
|
||||
|
||||
public static RegistryTrigger<Block> KINETIC_BLOCK = add(new RegistryTrigger<>("kinetic_block", Block.class));
|
||||
public static RegistryTrigger<Fluid> INFINITE_FLUID = add(new RegistryTrigger<>("infinite_fluid", Fluid.class));
|
||||
public static RegistryTrigger<Block> BRACKET_APPLY_TRIGGER = add(new RegistryTrigger<>("bracket_apply", Block.class));
|
||||
public static EnumTrigger<InWorldProcessing.Type> FAN_PROCESSING = add(new EnumTrigger<>("fan_processing", InWorldProcessing.Type.class));
|
||||
|
||||
public static SimpleTrigger
|
||||
ROTATION = simple("rotation"),
|
||||
|
@ -30,7 +32,6 @@ public class AllTriggers {
|
|||
LAVA_WHEEL = simple("lava_wheel"),
|
||||
CHOCOLATE_WHEEL = simple("chocolate_wheel"),
|
||||
DEPLOYER_BOOP = simple("deployer"),
|
||||
ABSORBED_LIGHT = simple("light_absorbed"),
|
||||
SPEED_READ = simple("speed_read"),
|
||||
BASIN_THROW = simple("basin"),
|
||||
PRESS_COMPACT = simple("compact"),
|
||||
|
@ -40,9 +41,6 @@ public class AllTriggers {
|
|||
MECHANICAL_ARM = simple("mechanical_arm"),
|
||||
MUSICAL_ARM = simple("musical_arm"),
|
||||
CUCKOO = simple("cuckoo"),
|
||||
BRACKET_SHAFT = simple("bracket_shaft"),
|
||||
BRACKET_COG = simple("bracket_cog"),
|
||||
BRACKET_PIPE = simple("bracket_pipe"),
|
||||
CASING_SHAFT = simple("casing_shaft"),
|
||||
CASING_BELT = simple("casing_belt"),
|
||||
CASING_PIPE = simple("casing_pipe"),
|
||||
|
@ -51,10 +49,6 @@ public class AllTriggers {
|
|||
PLACE_TUNNEL = simple("place_tunnel"),
|
||||
CONNECT_TUNNEL = simple("connect_tunnel"),
|
||||
UPWARD_CHUTE = simple("upward_chute"),
|
||||
FAN = simple("fan"),
|
||||
FAN_LAVA = simple("fan_lava"),
|
||||
FAN_SMOKE = simple("fan_smoke"),
|
||||
FAN_WATER = simple("fan_water"),
|
||||
BELT_FUNNEL = simple("belt_funnel"),
|
||||
BELT_FUNNEL_KISS = simple("belt_funnel_kiss"),
|
||||
CLOCKWORK_BEARING = simple("clockwork_bearing"),
|
||||
|
|
|
@ -77,7 +77,7 @@ public abstract class CriterionTriggerBase<T extends CriterionTriggerBase.Instan
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract static class Instance extends CriterionInstance {
|
||||
public abstract static class Instance extends CriterionInstance {
|
||||
|
||||
public Instance(ResourceLocation idIn) {
|
||||
super(idIn);
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.simibubi.create.foundation.advancement;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
public class EnumTrigger<T extends Enum<T>> extends StringSerializableTrigger<T> {
|
||||
private final Class<T> reference;
|
||||
|
||||
public EnumTrigger(String id, Class<T> reference) {
|
||||
super(id);
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected T getValue(String key) {
|
||||
try {
|
||||
return Enum.valueOf(reference, key);
|
||||
} catch (IllegalArgumentException | NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getKey(@Nullable T value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
return value.name();
|
||||
}
|
||||
}
|
|
@ -1,83 +1,35 @@
|
|||
package com.simibubi.create.foundation.advancement;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.RegistryManager;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
public class RegistryTrigger<T extends IForgeRegistryEntry<T>> extends CriterionTriggerBase<RegistryTrigger.Instance<T>> {
|
||||
private final Class<T> registryType;
|
||||
public class RegistryTrigger<T extends IForgeRegistryEntry<T>> extends StringSerializableTrigger<T> {
|
||||
private final IForgeRegistry<T> registry;
|
||||
|
||||
public RegistryTrigger(String id, Class<T> registryType) {
|
||||
super(id);
|
||||
this.registryType = registryType;
|
||||
}
|
||||
|
||||
public Instance<T> forEntry(@Nullable T registryEntry) {
|
||||
return new Instance<>(getId(), registryEntry);
|
||||
}
|
||||
|
||||
public void trigger(ServerPlayerEntity player, T registryEntry) {
|
||||
trigger(player, Collections.singletonList(() -> registryEntry));
|
||||
this.registry = RegistryManager.ACTIVE.getRegistry(registryType);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Instance<T> deserializeInstance(JsonObject json, JsonDeserializationContext context) {
|
||||
T entry = null;
|
||||
if (json.has("registry_entry")) {
|
||||
ResourceLocation entryLocation = new ResourceLocation(JSONUtils.getString(json, "registry_entry"));
|
||||
entry = RegistryManager.ACTIVE.getRegistry(registryType).getValue(entryLocation);
|
||||
protected T getValue(String key) {
|
||||
|
||||
if (entry == null)
|
||||
throw new JsonSyntaxException("Unknown registry entry '" + entryLocation + "'");
|
||||
}
|
||||
|
||||
return forEntry(entry);
|
||||
return registry.getValue(new ResourceLocation(key));
|
||||
}
|
||||
|
||||
|
||||
public static class Instance<T extends IForgeRegistryEntry<T>> extends CriterionTriggerBase.Instance {
|
||||
|
||||
@Nullable
|
||||
private final T entry;
|
||||
|
||||
public Instance(ResourceLocation id, @Nullable T registryEntry) {
|
||||
super(id);
|
||||
entry = registryEntry;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean test(@Nullable List<Supplier<Object>> suppliers) {
|
||||
if (entry == null || suppliers == null || suppliers.isEmpty())
|
||||
return false;
|
||||
return entry.equals(suppliers.get(0).get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize() {
|
||||
JsonObject jsonobject = new JsonObject();
|
||||
if (entry == null)
|
||||
return jsonobject;
|
||||
|
||||
ResourceLocation key = RegistryManager.ACTIVE.getRegistry(entry.getRegistryType()).getKey(entry);
|
||||
if (key != null) {
|
||||
jsonobject.addProperty("registry_entry", key.toString());
|
||||
}
|
||||
return jsonobject;
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getKey(T value) {
|
||||
ResourceLocation key = registry.getKey(value);
|
||||
return key == null ? null : key.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
package com.simibubi.create.foundation.advancement;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gson.*;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
public abstract class StringSerializableTrigger<T> extends CriterionTriggerBase<StringSerializableTrigger.Instance<T>> {
|
||||
public StringSerializableTrigger(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final Instance<T> forEntries(@Nullable T... entries) {
|
||||
return new Instance<>(this, entries == null ? null : Sets.newHashSet(entries));
|
||||
}
|
||||
|
||||
public void trigger(ServerPlayerEntity player, @Nullable T registryEntry) {
|
||||
trigger(player, Collections.singletonList(() -> registryEntry));
|
||||
}
|
||||
|
||||
public ITriggerable constructTriggerFor(@Nullable T entry) {
|
||||
BiConsumer<ServerPlayerEntity, T> trigger = this::trigger;
|
||||
return player -> trigger.accept(player, entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instance<T> deserializeInstance(JsonObject json, JsonDeserializationContext context) {
|
||||
if (json.has("accepted_entries")) {
|
||||
JsonArray elements = json.getAsJsonArray("accepted_entries");
|
||||
return new Instance<>(this,
|
||||
StreamSupport.stream(elements.spliterator(), false).map(JsonElement::getAsString)
|
||||
.map(rl -> {
|
||||
T entry = getValue(rl);
|
||||
if (entry == null)
|
||||
throw new JsonSyntaxException("Unknown entry '" + rl + "'");
|
||||
return entry;
|
||||
}).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
return forEntries((T) null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
abstract protected T getValue(String key);
|
||||
|
||||
@Nullable
|
||||
abstract protected String getKey(T value);
|
||||
|
||||
public static class Instance<T> extends CriterionTriggerBase.Instance {
|
||||
|
||||
@Nullable
|
||||
private final Set<T> entries;
|
||||
private final StringSerializableTrigger<T> trigger;
|
||||
|
||||
public Instance(StringSerializableTrigger<T> trigger, @Nullable Set<T> entries) {
|
||||
super(trigger.getId());
|
||||
this.trigger = trigger;
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean test(@Nullable List<Supplier<Object>> suppliers) {
|
||||
if (entries == null || suppliers == null || suppliers.isEmpty())
|
||||
return false;
|
||||
return entries.contains(suppliers.get(0).get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize() {
|
||||
JsonObject jsonobject = new JsonObject();
|
||||
JsonArray elements = new JsonArray();
|
||||
|
||||
if (entries == null) {
|
||||
jsonobject.add("accepted_entries", elements);
|
||||
return jsonobject;
|
||||
}
|
||||
|
||||
for (T entry : entries) {
|
||||
if (entry == null)
|
||||
continue;
|
||||
String key = trigger.getKey(entry);
|
||||
if (key != null)
|
||||
elements.add(key);
|
||||
}
|
||||
|
||||
jsonobject.add("accepted_entries", elements);
|
||||
return jsonobject;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue