mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
impl fabric
This commit is contained in:
@@ -32,7 +32,7 @@ public class BlockFunctionBuilder implements FunctionBuilder<BlockFunction> {
|
||||
if(argumentList.size() < 4) throw new ParseException("Expected data", position);
|
||||
Returnable<Boolean> overwrite = new BooleanConstant(true, position);
|
||||
if(argumentList.size() >= 5) overwrite = (Returnable<Boolean>) argumentList.get(4);
|
||||
Returnable<Boolean> physics = new BooleanConstant(true, position);
|
||||
Returnable<Boolean> physics = new BooleanConstant(false, position);
|
||||
if(argumentList.size() == 6) physics = (Returnable<Boolean>) argumentList.get(5);
|
||||
if(argumentList.get(3) instanceof StringConstant) {
|
||||
return new BlockFunction.Constant((Returnable<Number>) argumentList.get(0), (Returnable<Number>) argumentList.get(1),
|
||||
@@ -40,7 +40,7 @@ public class BlockFunctionBuilder implements FunctionBuilder<BlockFunction> {
|
||||
overwrite, physics, platform, position);
|
||||
}
|
||||
return new BlockFunction((Returnable<Number>) argumentList.get(0), (Returnable<Number>) argumentList.get(1),
|
||||
(Returnable<Number>) argumentList.get(2), (Returnable<String>) argumentList.get(3), booleanReturnable,
|
||||
(Returnable<Number>) argumentList.get(2), (Returnable<String>) argumentList.get(3), overwrite, physics,
|
||||
platform, position);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
|
||||
package com.dfsek.terra.mod.mixin.implementations.terra.chunk;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.chunk.Chunk.TickSchedulers;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
import net.minecraft.world.tick.OrderedTick;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@@ -47,8 +50,21 @@ public abstract class WorldChunkMixin {
|
||||
@Nullable
|
||||
public abstract net.minecraft.block.BlockState setBlockState(BlockPos pos, net.minecraft.block.BlockState state, boolean moved);
|
||||
|
||||
@Shadow
|
||||
public abstract TickSchedulers getTickSchedulers();
|
||||
|
||||
public void terra$setBlock(int x, int y, int z, BlockState data, boolean physics) {
|
||||
setBlockState(new BlockPos(x, y, z), (net.minecraft.block.BlockState) data, false);
|
||||
BlockPos blockPos = new BlockPos(x, y, z);
|
||||
setBlockState(blockPos, (net.minecraft.block.BlockState) data, false);
|
||||
if (physics) {
|
||||
net.minecraft.block.BlockState state = ((net.minecraft.block.BlockState) data);
|
||||
if (state.isLiquid()) {
|
||||
world.getFluidTickScheduler().scheduleTick(OrderedTick.create(state.getFluidState().getFluid(), blockPos));
|
||||
} else {
|
||||
world.getBlockTickScheduler().scheduleTick(OrderedTick.create(state.getBlock(), blockPos));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
||||
|
||||
Reference in New Issue
Block a user