Readme, automatic linting run. Factory Dropper: External Redstone mode added. Catwalk default state fixed (issue #140).

This commit is contained in:
stfwi 2020-12-05 09:33:52 +01:00
parent 93df09acd9
commit ed30ee49df
12 changed files with 66 additions and 49 deletions

View file

@ -71,7 +71,7 @@ public class EdCatwalkStairsBlock extends DecorBlock.HorizontalWaterLoggable imp
y_rotations.put(Direction.WEST, 3);
y_rotations.put(Direction.UP, 0);
y_rotations.put(Direction.DOWN, 0);
setDefaultState(getStateContainer().getBaseState().with(LEFT_RAILING, false).with(RIGHT_RAILING, false));
setDefaultState(super.getDefaultState().with(LEFT_RAILING, false).with(RIGHT_RAILING, false));
}
@Override

View file

@ -38,7 +38,7 @@ public class EdCatwalkTopAlignedBlock extends DecorBlock.WaterLoggable implement
public EdCatwalkTopAlignedBlock(long config, Block.Properties properties, final VoxelShape[] variant_shapes)
{
super(config, properties, variant_shapes[0]);
setDefaultState(getStateContainer().getBaseState().with(VARIANT, 0));
setDefaultState(super.getDefaultState().with(VARIANT, 0));
this.variant_shapes = VARIANT.getAllowedValues().stream().map(i->(i<variant_shapes.length) ? (variant_shapes[i]) : (VoxelShapes.fullCube())).collect(Collectors.toList());
}

View file

@ -225,6 +225,7 @@ public class EdDropper
public static final int DROPLOGIC_SILENT_DROP = 0x04;
public static final int DROPLOGIC_SILENT_OPEN = 0x08;
public static final int DROPLOGIC_CONTINUOUS = 0x10;
public static final int DROPLOGIC_IGNORE_EXT = 0x20;
///
private int filter_matches_[] = new int[CTRL_SLOTS_SIZE];
private int open_timer_ = 0;
@ -597,7 +598,7 @@ public class EdDropper
if(!(world.getBlockState(pos).getBlock() instanceof DropperBlock)) return;
final boolean continuous_mode = (drop_logic_ & DROPLOGIC_CONTINUOUS)!=0;
boolean dirty = block_power_updated_;
boolean redstone_trigger = (block_power_signal_ && ((block_power_updated_) || (continuous_mode)));
boolean redstone_trigger = (block_power_signal_ && ((block_power_updated_) || (continuous_mode))) || ((drop_logic_ & DROPLOGIC_IGNORE_EXT)!=0);
boolean filter_trigger;
boolean filter_defined;
boolean trigger;
@ -916,7 +917,7 @@ public class EdDropper
@Override
public void render(MatrixStack mx, int mouseX, int mouseY, float partialTicks)
{
renderBackground/*renderBackground*/(mx);
renderBackground(mx);
super.render(mx, mouseX, mouseY, partialTicks);
if(!tooltip_.render(mx, this, mouseX, mouseY)) renderHoveredTooltip(mx, mouseX, mouseY);
}
@ -973,7 +974,15 @@ public class EdDropper
} else if(isPointInRegion(132, 66, 9, 9, mouseX, mouseY)) {
container.onGuiAction("drop_logic", container.field(5) ^ DropperTileEntity.DROPLOGIC_FILTER_ANDGATE);
} else if(isPointInRegion(148, 66, 9, 9, mouseX, mouseY)) {
container.onGuiAction("drop_logic", container.field(5) ^ DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE);
final int mask = (DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE|DropperTileEntity.DROPLOGIC_IGNORE_EXT);
int logic = (container.field(5) & mask);
switch(logic) {
case DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE: logic = 0; break;
case 0: logic = DropperTileEntity.DROPLOGIC_IGNORE_EXT; break;
case DropperTileEntity.DROPLOGIC_IGNORE_EXT: logic = DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE; break;
default: logic = DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE;
}
container.onGuiAction("drop_logic", (container.field(5) & (~mask)) | logic);
}
return true;
}
@ -1051,11 +1060,13 @@ public class EdDropper
}
// trigger logic
{
int filter_gate_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_FILTER_ANDGATE) != 0) ? 11 : 0;
int extern_gate_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE) != 0) ? 11 : 0;
int pulse_mode_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_CONTINUOUS ) != 0) ? 10 : 0;
final int logic = container.field(5);
int filter_gate_offset = ((logic & DropperTileEntity.DROPLOGIC_FILTER_ANDGATE) != 0) ? 11 : 0;
int pulse_mode_offset = ((logic & DropperTileEntity.DROPLOGIC_CONTINUOUS ) != 0) ? 10 : 0;
int extern_gate_offset_x = ((logic & DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE) != 0) ? 11 : 0;
int extern_gate_offset_y = ((logic & DropperTileEntity.DROPLOGIC_IGNORE_EXT) != 0) ? 10 : 0;
blit(mx, x0+132, y0+66, 179+filter_gate_offset, 66, 9, 9);
blit(mx, x0+148, y0+66, 179+extern_gate_offset, 66, 9, 9);
blit(mx, x0+148, y0+66, 179+extern_gate_offset_x, 66+extern_gate_offset_y, 9, 9);
blit(mx, x0+162, y0+66, 200+pulse_mode_offset, 66, 9, 9);
}
// drop timer running indicator

View file

@ -9,12 +9,7 @@
package wile.engineersdecor.blocks;
import com.mojang.blaze3d.matrix.MatrixStack;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ExternalObjects;
import wile.engineersdecor.libmc.client.ContainerGui;
import wile.engineersdecor.libmc.detail.Inventories;
import wile.engineersdecor.libmc.detail.Networking;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.tileentity.*;
import net.minecraft.inventory.container.*;
import net.minecraft.item.crafting.AbstractCookingRecipe;
@ -59,7 +54,12 @@ import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.SidedInvWrapper;
import com.mojang.blaze3d.systems.RenderSystem;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ExternalObjects;
import wile.engineersdecor.libmc.client.ContainerGui;
import wile.engineersdecor.libmc.detail.Inventories;
import wile.engineersdecor.libmc.detail.Networking;
import javax.annotation.Nullable;
import java.util.*;

View file

@ -47,7 +47,7 @@ public class EdRoofBlock extends StandardBlocks.HorizontalWaterLoggable implemen
public EdRoofBlock(long config, Block.Properties properties, VoxelShape add, VoxelShape cut)
{
super(config, properties, Auxiliaries.getPixeledAABB(0, 0,0,16, 8, 16));
setDefaultState(stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(SHAPE, StairsShape.STRAIGHT).with(WATERLOGGED, false));
setDefaultState(super.getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH).with(SHAPE, StairsShape.STRAIGHT));
shape_cache_ = makeShapes(add, cut);
}

View file

@ -53,7 +53,7 @@ public class EdSolarPanel
public SolarPanelBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
{
super(config, builder, unrotatedAABB);
setDefaultState(stateContainer.getBaseState().with(EXPOSITION, 1));
setDefaultState(super.getDefaultState().with(EXPOSITION, 1));
}
@Override

View file

@ -14,7 +14,6 @@ package wile.engineersdecor.libmc.blocks;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.pathfinding.PathType;
import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.block.*;
import net.minecraft.entity.EntityType;
import net.minecraft.state.DirectionProperty;
@ -48,6 +47,7 @@ import net.minecraft.util.*;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import wile.engineersdecor.libmc.detail.Auxiliaries;
import javax.annotation.Nullable;
import java.util.*;
import java.util.function.Supplier;
@ -110,17 +110,19 @@ public class StandardBlocks
{ this(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); }
public BaseBlock(long conf, Block.Properties properties, AxisAlignedBB aabb)
{ super(properties); config = conf; vshape = VoxelShapes.create(aabb); }
public BaseBlock(long conf, Block.Properties properties, VoxelShape voxel_shape)
{ super(properties); config = conf; vshape = voxel_shape; }
{ this(conf, properties, VoxelShapes.create(aabb)); }
public BaseBlock(long conf, Block.Properties properties, AxisAlignedBB[] aabbs)
{ this(conf, properties, Arrays.stream(aabbs).map(aabb->VoxelShapes.create(aabb)).reduce(VoxelShapes.empty(), (shape, aabb)->VoxelShapes.combine(shape, aabb, IBooleanFunction.OR))); }
public BaseBlock(long conf, Block.Properties properties, VoxelShape voxel_shape)
{
super(properties); config = conf;
VoxelShape shape = VoxelShapes.empty();
for(AxisAlignedBB aabb:aabbs) shape = VoxelShapes.combine(shape, VoxelShapes.create(aabb), IBooleanFunction.OR);
vshape = shape;
super(properties);
config = conf;
vshape = voxel_shape;
BlockState state = getStateContainer().getBaseState();
if((conf & CFG_WATERLOGGABLE)!=0) state = state.with(WATERLOGGED, false);
setDefaultState(state);
}
@Override
@ -471,7 +473,7 @@ public class StandardBlocks
}
shapes = build_shapes;
collision_shapes = build_collision_shapes;
setDefaultState(getStateContainer().getBaseState().with(NORTH, false).with(EAST, false).with(SOUTH, false).with(WEST, false).with(WATERLOGGED, false));
setDefaultState(super.getDefaultState().with(NORTH, false).with(EAST, false).with(SOUTH, false).with(WEST, false).with(WATERLOGGED, false));
}
@Override