mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-09 19:44:40 +01:00
Schematic Problematic
- Fixed ammo-specific fire damage not dropping cooked drops from killed entities - Fixed Schematicannons not visually aiming toward current block trajectory - Fixed placed Schematics using smaller boundaries than the original - Added the option to enable/disable placing air blocks with instant creative schematic printing - Added safety check for Missing/Migrated filter attributes #2065 - Added safety check for Crushing wheels near unloaded blocks - Added safety check for instant printing an invalid Schematic
This commit is contained in:
parent
468435e1a0
commit
8dd2f1dbf6
10 changed files with 54 additions and 13 deletions
|
@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G
|
||||||
org.gradle.daemon = false
|
org.gradle.daemon = false
|
||||||
|
|
||||||
# mod version info
|
# mod version info
|
||||||
mod_version = 0.3.2c
|
mod_version = 0.3.2d
|
||||||
minecraft_version = 1.16.5
|
minecraft_version = 1.16.5
|
||||||
forge_version = 36.2.0
|
forge_version = 36.2.0
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Create {
|
||||||
|
|
||||||
public static final String ID = "create";
|
public static final String ID = "create";
|
||||||
public static final String NAME = "Create";
|
public static final String NAME = "Create";
|
||||||
public static final String VERSION = "0.3.2c";
|
public static final String VERSION = "0.3.2d";
|
||||||
|
|
||||||
public static final Logger LOGGER = LogManager.getLogger();
|
public static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
|
||||||
|
|
|
@ -156,8 +156,10 @@ public class CrushingWheelControllerBlock extends DirectionalBlock
|
||||||
continue;
|
continue;
|
||||||
if (neighbour.getValue(BlockStateProperties.AXIS) == d.getAxis())
|
if (neighbour.getValue(BlockStateProperties.AXIS) == d.getAxis())
|
||||||
continue;
|
continue;
|
||||||
KineticTileEntity wheelTe = (KineticTileEntity) world.getBlockEntity(pos.relative(d));
|
TileEntity adjTe = world.getBlockEntity(pos.relative(d));
|
||||||
te.crushingspeed = Math.abs(wheelTe.getSpeed() / 50f);
|
if (!(adjTe instanceof KineticTileEntity))
|
||||||
|
continue;
|
||||||
|
te.crushingspeed = Math.abs(((KineticTileEntity) adjTe).getSpeed() / 50f);
|
||||||
te.sendData();
|
te.sendData();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class PotatoCannonProjectileTypes {
|
||||||
.velocity(1.25f)
|
.velocity(1.25f)
|
||||||
.knockback(0.5f)
|
.knockback(0.5f)
|
||||||
.renderTumbling()
|
.renderTumbling()
|
||||||
.onEntityHit(setFire(3))
|
.preEntityHit(setFire(3))
|
||||||
.registerAndAssign(Items.BAKED_POTATO),
|
.registerAndAssign(Items.BAKED_POTATO),
|
||||||
|
|
||||||
CARROT = create("carrot").damage(4)
|
CARROT = create("carrot").damage(4)
|
||||||
|
@ -247,7 +247,7 @@ public class PotatoCannonProjectileTypes {
|
||||||
.velocity(1.1f)
|
.velocity(1.1f)
|
||||||
.renderTumbling()
|
.renderTumbling()
|
||||||
.sticky()
|
.sticky()
|
||||||
.onEntityHit(setFire(12))
|
.preEntityHit(setFire(12))
|
||||||
.soundPitch(1.0f)
|
.soundPitch(1.0f)
|
||||||
.registerAndAssign(AllItems.BLAZE_CAKE.get())
|
.registerAndAssign(AllItems.BLAZE_CAKE.get())
|
||||||
;
|
;
|
||||||
|
@ -286,7 +286,8 @@ public class PotatoCannonProjectileTypes {
|
||||||
private float fwoompPitch = 1;
|
private float fwoompPitch = 1;
|
||||||
private boolean sticky = false;
|
private boolean sticky = false;
|
||||||
private PotatoProjectileRenderMode renderMode = new PotatoProjectileRenderMode.Billboard();
|
private PotatoProjectileRenderMode renderMode = new PotatoProjectileRenderMode.Billboard();
|
||||||
private Predicate<EntityRayTraceResult> onEntityHit = e -> false;
|
private Predicate<EntityRayTraceResult> preEntityHit = e -> false; // True if hit should be canceled
|
||||||
|
private Predicate<EntityRayTraceResult> onEntityHit = e -> false; // True if shouldn't recover projectile
|
||||||
private BiPredicate<IWorld, BlockRayTraceResult> onBlockHit = (w, ray) -> false;
|
private BiPredicate<IWorld, BlockRayTraceResult> onBlockHit = (w, ray) -> false;
|
||||||
|
|
||||||
public float getGravityMultiplier() {
|
public float getGravityMultiplier() {
|
||||||
|
@ -327,6 +328,10 @@ public class PotatoCannonProjectileTypes {
|
||||||
|
|
||||||
public boolean isSticky() { return sticky; }
|
public boolean isSticky() { return sticky; }
|
||||||
|
|
||||||
|
public boolean preEntityHit(EntityRayTraceResult ray) {
|
||||||
|
return preEntityHit.test(ray);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onEntityHit(EntityRayTraceResult ray) {
|
public boolean onEntityHit(EntityRayTraceResult ray) {
|
||||||
return onEntityHit.test(ray);
|
return onEntityHit.test(ray);
|
||||||
}
|
}
|
||||||
|
@ -542,6 +547,11 @@ public class PotatoCannonProjectileTypes {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder preEntityHit(Predicate<EntityRayTraceResult> callback) {
|
||||||
|
result.preEntityHit = callback;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder onEntityHit(Predicate<EntityRayTraceResult> callback) {
|
public Builder onEntityHit(Predicate<EntityRayTraceResult> callback) {
|
||||||
result.onEntityHit = callback;
|
result.onEntityHit = callback;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -190,6 +190,8 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements
|
||||||
|
|
||||||
if (target instanceof WitherEntity && ((WitherEntity) target).isPowered())
|
if (target instanceof WitherEntity && ((WitherEntity) target).isPowered())
|
||||||
return;
|
return;
|
||||||
|
if (projectileType.preEntityHit(ray))
|
||||||
|
return;
|
||||||
|
|
||||||
boolean targetIsEnderman = target.getType() == EntityType.ENDERMAN;
|
boolean targetIsEnderman = target.getType() == EntityType.ENDERMAN;
|
||||||
int k = target.getRemainingFireTicks();
|
int k = target.getRemainingFireTicks();
|
||||||
|
|
|
@ -220,6 +220,8 @@ public class FilterItem extends Item implements INamedContainerProvider {
|
||||||
for (INBT inbt : attributes) {
|
for (INBT inbt : attributes) {
|
||||||
CompoundNBT compound = (CompoundNBT) inbt;
|
CompoundNBT compound = (CompoundNBT) inbt;
|
||||||
ItemAttribute attribute = ItemAttribute.fromNBT(compound);
|
ItemAttribute attribute = ItemAttribute.fromNBT(compound);
|
||||||
|
if (attribute == null)
|
||||||
|
continue;
|
||||||
boolean matches = attribute.appliesTo(stack, world) != compound.getBoolean("Inverted");
|
boolean matches = attribute.appliesTo(stack, world) != compound.getBoolean("Inverted");
|
||||||
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
|
|
|
@ -51,7 +51,14 @@ public class SchematicPrinter {
|
||||||
public void fromTag(CompoundNBT compound, boolean clientPacket) {
|
public void fromTag(CompoundNBT compound, boolean clientPacket) {
|
||||||
if (compound.contains("CurrentPos"))
|
if (compound.contains("CurrentPos"))
|
||||||
currentPos = NBTUtil.readBlockPos(compound.getCompound("CurrentPos"));
|
currentPos = NBTUtil.readBlockPos(compound.getCompound("CurrentPos"));
|
||||||
|
if (clientPacket) {
|
||||||
|
schematicLoaded = false;
|
||||||
|
if (compound.contains("Anchor")) {
|
||||||
|
schematicAnchor = NBTUtil.readBlockPos(compound.getCompound("Anchor"));
|
||||||
|
schematicLoaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printingEntityIndex = compound.getInt("EntityProgress");
|
printingEntityIndex = compound.getInt("EntityProgress");
|
||||||
printStage = PrintStage.valueOf(compound.getString("PrintStage"));
|
printStage = PrintStage.valueOf(compound.getString("PrintStage"));
|
||||||
compound.getList("DeferredBlocks", 10).stream()
|
compound.getList("DeferredBlocks", 10).stream()
|
||||||
|
@ -62,7 +69,9 @@ public class SchematicPrinter {
|
||||||
public void write(CompoundNBT compound) {
|
public void write(CompoundNBT compound) {
|
||||||
if (currentPos != null)
|
if (currentPos != null)
|
||||||
compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos));
|
compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos));
|
||||||
|
if (schematicAnchor != null)
|
||||||
|
compound.put("Anchor", NBTUtil.writeBlockPos(schematicAnchor));
|
||||||
|
|
||||||
compound.putInt("EntityProgress", printingEntityIndex);
|
compound.putInt("EntityProgress", printingEntityIndex);
|
||||||
compound.putString("PrintStage", printStage.name());
|
compound.putString("PrintStage", printStage.name());
|
||||||
ListNBT tagDeferredBlocks = new ListNBT();
|
ListNBT tagDeferredBlocks = new ListNBT();
|
||||||
|
@ -78,15 +87,19 @@ public class SchematicPrinter {
|
||||||
Template activeTemplate = SchematicItem.loadSchematic(blueprint);
|
Template activeTemplate = SchematicItem.loadSchematic(blueprint);
|
||||||
PlacementSettings settings = SchematicItem.getSettings(blueprint, processNBT);
|
PlacementSettings settings = SchematicItem.getSettings(blueprint, processNBT);
|
||||||
|
|
||||||
schematicAnchor = NBTUtil.readBlockPos(blueprint.getTag().getCompound("Anchor"));
|
schematicAnchor = NBTUtil.readBlockPos(blueprint.getTag()
|
||||||
|
.getCompound("Anchor"));
|
||||||
blockReader = new SchematicWorld(schematicAnchor, originalWorld);
|
blockReader = new SchematicWorld(schematicAnchor, originalWorld);
|
||||||
activeTemplate.placeInWorldChunk(blockReader, schematicAnchor, settings, blockReader.getRandom());
|
activeTemplate.placeInWorldChunk(blockReader, schematicAnchor, settings, blockReader.getRandom());
|
||||||
|
|
||||||
|
BlockPos extraBounds = Template.calculateRelativePosition(settings, activeTemplate.getSize()
|
||||||
|
.offset(-1, -1, -1));
|
||||||
|
blockReader.bounds.expand(new MutableBoundingBox(extraBounds, extraBounds));
|
||||||
|
|
||||||
StructureTransform transform = new StructureTransform(settings.getRotationPivot(), Direction.Axis.Y,
|
StructureTransform transform = new StructureTransform(settings.getRotationPivot(), Direction.Axis.Y,
|
||||||
settings.getRotation(), settings.getMirror());
|
settings.getRotation(), settings.getMirror());
|
||||||
for (TileEntity te : blockReader.tileEntities.values()) {
|
for (TileEntity te : blockReader.tileEntities.values())
|
||||||
transform.apply(te);
|
transform.apply(te);
|
||||||
}
|
|
||||||
|
|
||||||
printingEntityIndex = -1;
|
printingEntityIndex = -1;
|
||||||
printStage = PrintStage.BLOCKS;
|
printStage = PrintStage.BLOCKS;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.schematics.packet;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.simibubi.create.content.schematics.SchematicPrinter;
|
import com.simibubi.create.content.schematics.SchematicPrinter;
|
||||||
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
|
|
||||||
|
@ -38,12 +39,20 @@ public class SchematicPlacePacket extends SimplePacketBase {
|
||||||
World world = player.getLevel();
|
World world = player.getLevel();
|
||||||
SchematicPrinter printer = new SchematicPrinter();
|
SchematicPrinter printer = new SchematicPrinter();
|
||||||
printer.loadSchematic(stack, world, !player.canUseGameMasterBlocks());
|
printer.loadSchematic(stack, world, !player.canUseGameMasterBlocks());
|
||||||
|
if (!printer.isLoaded())
|
||||||
|
return;
|
||||||
|
|
||||||
|
boolean includeAir = AllConfigs.SERVER.schematics.creativePrintIncludesAir.get();
|
||||||
|
|
||||||
while (printer.advanceCurrentPos()) {
|
while (printer.advanceCurrentPos()) {
|
||||||
if (!printer.shouldPlaceCurrent(world))
|
if (!printer.shouldPlaceCurrent(world))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printer.handleCurrentTarget((pos, state, tile) -> {
|
printer.handleCurrentTarget((pos, state, tile) -> {
|
||||||
|
boolean placingAir = state.getBlock().isAir(state, world, pos);
|
||||||
|
if (placingAir && !includeAir)
|
||||||
|
return;
|
||||||
|
|
||||||
CompoundNBT tileData = tile != null ? tile.save(new CompoundNBT()) : null;
|
CompoundNBT tileData = tile != null ? tile.save(new CompoundNBT()) : null;
|
||||||
BlockHelper.placeSchematicBlock(world, state, pos, null, tileData);
|
BlockHelper.placeSchematicBlock(world, state, pos, null, tileData);
|
||||||
}, (pos, entity) -> {
|
}, (pos, entity) -> {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.foundation.config;
|
||||||
|
|
||||||
public class CSchematics extends ConfigBase {
|
public class CSchematics extends ConfigBase {
|
||||||
|
|
||||||
|
public ConfigBool creativePrintIncludesAir = b(false, "creativePrintIncludesAir", Comments.creativePrintIncludesAir);
|
||||||
public ConfigInt maxSchematics = i(10, 1, "maxSchematics", Comments.maxSchematics);
|
public ConfigInt maxSchematics = i(10, 1, "maxSchematics", Comments.maxSchematics);
|
||||||
public ConfigInt maxTotalSchematicSize = i(256, 16, "maxSchematics", Comments.kb, Comments.maxSize);
|
public ConfigInt maxTotalSchematicSize = i(256, 16, "maxSchematics", Comments.kb, Comments.maxSize);
|
||||||
public ConfigInt maxSchematicPacketSize =
|
public ConfigInt maxSchematicPacketSize =
|
||||||
|
@ -33,6 +34,8 @@ public class CSchematics extends ConfigBase {
|
||||||
static String skips = "Amount of block positions per tick scanned by a running cannon. Higher => Faster";
|
static String skips = "Amount of block positions per tick scanned by a running cannon. Higher => Faster";
|
||||||
static String gunpowderWorth = "% of Schematicannon's Fuel filled by 1 Gunpowder.";
|
static String gunpowderWorth = "% of Schematicannon's Fuel filled by 1 Gunpowder.";
|
||||||
static String fuelUsage = "% of Schematicannon's Fuel used for each fired block.";
|
static String fuelUsage = "% of Schematicannon's Fuel used for each fired block.";
|
||||||
|
static String creativePrintIncludesAir =
|
||||||
|
"Whether placing a Schematic directly in Creative Mode should replace world blocks with Air";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ license="MIT"
|
||||||
|
|
||||||
[[mods]]
|
[[mods]]
|
||||||
modId="create"
|
modId="create"
|
||||||
version="v0.3.2c for 1.16.5"
|
version="v0.3.2d"
|
||||||
displayName="Create"
|
displayName="Create"
|
||||||
#updateJSONURL=""
|
#updateJSONURL=""
|
||||||
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"
|
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"
|
||||||
|
|
Loading…
Reference in a new issue