Merge remote-tracking branch 'origin/1.16' into 1.16
This commit is contained in:
commit
bd88aabe68
6 changed files with 110 additions and 12 deletions
|
@ -91,6 +91,8 @@ dependencies {
|
||||||
include rcVersion
|
include rcVersion
|
||||||
|
|
||||||
modApi 'teamreborn:energy:0.1.0'
|
modApi 'teamreborn:energy:0.1.0'
|
||||||
|
|
||||||
|
optionalDependency "com.github.dexman545:autoswitch-api:-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
def optionalDependency(String dep) {
|
def optionalDependency(String dep) {
|
||||||
|
|
|
@ -102,9 +102,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
|
|
||||||
public BooleanProperty getProperty(Direction facing) {
|
public BooleanProperty getProperty(Direction facing) {
|
||||||
switch (facing) {
|
switch (facing) {
|
||||||
case EAST:
|
case WEST:
|
||||||
return EAST;
|
|
||||||
case WEST:
|
|
||||||
return WEST;
|
return WEST;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
return NORTH;
|
return NORTH;
|
||||||
|
@ -120,18 +118,18 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockState makeConnections(World world, BlockPos pos) {
|
private BlockState makeConnections(World world, BlockPos pos) {
|
||||||
Boolean down = canConnectTo(world, pos.offset(Direction.DOWN, 1), Direction.UP);
|
Boolean down = canConnectTo(world, pos.down());
|
||||||
Boolean up = canConnectTo(world, pos.up(), Direction.DOWN);
|
Boolean up = canConnectTo(world, pos.up());
|
||||||
Boolean north = canConnectTo(world, pos.north(), Direction.SOUTH);
|
Boolean north = canConnectTo(world, pos.north());
|
||||||
Boolean east = canConnectTo(world, pos.east(), Direction.WEST);
|
Boolean east = canConnectTo(world, pos.east());
|
||||||
Boolean south = canConnectTo(world, pos.south(), Direction.NORTH);
|
Boolean south = canConnectTo(world, pos.south());
|
||||||
Boolean west = canConnectTo(world, pos.west(), Direction.WEST);
|
Boolean west = canConnectTo(world, pos.west());
|
||||||
|
|
||||||
return this.getDefaultState().with(DOWN, down).with(UP, up).with(NORTH, north).with(EAST, east)
|
return this.getDefaultState().with(DOWN, down).with(UP, up).with(NORTH, north).with(EAST, east)
|
||||||
.with(SOUTH, south).with(WEST, west);
|
.with(SOUTH, south).with(WEST, west);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean canConnectTo(WorldAccess world, BlockPos pos, Direction facing) {
|
private Boolean canConnectTo(WorldAccess world, BlockPos pos) {
|
||||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
if (blockEntity != null && (Energy.valid(blockEntity) || blockEntity instanceof CableBlockEntity)) {
|
if (blockEntity != null && (Energy.valid(blockEntity) || blockEntity instanceof CableBlockEntity)) {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
|
@ -152,6 +150,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block
|
// Block
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
|
||||||
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
|
||||||
|
@ -199,16 +198,18 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
.with(WATERLOGGED, context.getWorld().getFluidState(context.getBlockPos()).getFluid() == Fluids.WATER);
|
.with(WATERLOGGED, context.getWorld().getFluidState(context.getBlockPos()).getFluid() == Fluids.WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForNeighborUpdate(BlockState ourState, Direction ourFacing, BlockState otherState,
|
public BlockState getStateForNeighborUpdate(BlockState ourState, Direction ourFacing, BlockState otherState,
|
||||||
WorldAccess worldIn, BlockPos ourPos, BlockPos otherPos) {
|
WorldAccess worldIn, BlockPos ourPos, BlockPos otherPos) {
|
||||||
if (ourState.get(WATERLOGGED)) {
|
if (ourState.get(WATERLOGGED)) {
|
||||||
worldIn.getFluidTickScheduler().schedule(ourPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
|
worldIn.getFluidTickScheduler().schedule(ourPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
|
||||||
}
|
}
|
||||||
Boolean value = canConnectTo(worldIn, otherPos, ourFacing.getOpposite());
|
Boolean value = canConnectTo(worldIn, otherPos);
|
||||||
return ourState.with(getProperty(ourFacing), value);
|
return ourState.with(getProperty(ourFacing), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext shapeContext) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext shapeContext) {
|
||||||
if (state.get(COVERED)) {
|
if (state.get(COVERED)) {
|
||||||
|
@ -217,6 +218,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
return cableShapeUtil.getShape(state);
|
return cableShapeUtil.getShape(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
|
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
|
||||||
super.onEntityCollision(state, worldIn, pos, entityIn);
|
super.onEntityCollision(state, worldIn, pos, entityIn);
|
||||||
|
@ -245,6 +247,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
entityIn.setOnFireFor(1);
|
entityIn.setOnFireFor(1);
|
||||||
}
|
}
|
||||||
entityIn.damage(new ElectrialShockSource(), 1F);
|
entityIn.damage(new ElectrialShockSource(), 1F);
|
||||||
|
blockEntityCable.setEnergy(0d);
|
||||||
}
|
}
|
||||||
if (TechRebornConfig.uninsulatedElectrocutionSound) {
|
if (TechRebornConfig.uninsulatedElectrocutionSound) {
|
||||||
worldIn.playSound(null, entityIn.getX(), entityIn.getY(), entityIn.getZ(), ModSounds.CABLE_SHOCK, SoundCategory.BLOCKS,
|
worldIn.playSound(null, entityIn.getX(), entityIn.getY(), entityIn.getZ(), ModSounds.CABLE_SHOCK, SoundCategory.BLOCKS,
|
||||||
|
@ -265,6 +268,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
return !state.get(COVERED) && Waterloggable.super.canFillWithFluid(view, pos, state, fluid);
|
return !state.get(COVERED) && Waterloggable.super.canFillWithFluid(view, pos, state, fluid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public FluidState getFluidState(BlockState state) {
|
public FluidState getFluidState(BlockState state) {
|
||||||
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package techreborn.compat.autoswitch;
|
||||||
|
|
||||||
|
import autoswitch.api.AutoSwitchApi;
|
||||||
|
import autoswitch.api.AutoSwitchMap;
|
||||||
|
import autoswitch.api.DurabilityGetter;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.tag.Tag;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
import reborncore.common.util.ItemUtils;
|
||||||
|
import techreborn.items.tool.ChainsawItem;
|
||||||
|
import techreborn.items.tool.DrillItem;
|
||||||
|
import techreborn.items.tool.JackhammerItem;
|
||||||
|
import techreborn.items.tool.advanced.RockCutterItem;
|
||||||
|
import techreborn.items.tool.basic.ElectricTreetapItem;
|
||||||
|
import techreborn.items.tool.industrial.NanosaberItem;
|
||||||
|
import techreborn.items.tool.industrial.OmniToolItem;
|
||||||
|
|
||||||
|
public class AutoSwitchApiImpl implements AutoSwitchApi {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void moddedTargets(AutoSwitchMap<String, Object> targets, AutoSwitchMap<String, String> actionConfig, AutoSwitchMap<String, String> usableConfig) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void moddedToolGroups(AutoSwitchMap<String, Pair<Tag<Item>, Class<?>>> toolGroupings) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void customDamageSystems(AutoSwitchMap<Class<?>, DurabilityGetter> damageMap) {
|
||||||
|
// Multiple by 100 to get percentage out of decimal form
|
||||||
|
damageMap.put(DrillItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||||
|
damageMap.put(ChainsawItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||||
|
damageMap.put(JackhammerItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||||
|
damageMap.put(NanosaberItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||||
|
damageMap.put(OmniToolItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||||
|
damageMap.put(ElectricTreetapItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||||
|
damageMap.put(RockCutterItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"type": "techreborn:blast_furnace",
|
||||||
|
"power": 128,
|
||||||
|
"time": 140,
|
||||||
|
"heat": 1000,
|
||||||
|
"ingredients" : [
|
||||||
|
{
|
||||||
|
"item": "minecraft:minecart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item": "minecraft:sand"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"results" : [
|
||||||
|
{
|
||||||
|
"item": "minecraft:iron_ingot",
|
||||||
|
"count": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item": "techreborn:dark_ashes_dust"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"type": "techreborn:blast_furnace",
|
||||||
|
"power": 128,
|
||||||
|
"time": 140,
|
||||||
|
"heat": 1000,
|
||||||
|
"ingredients" : [
|
||||||
|
{
|
||||||
|
"item": "minecraft:rail",
|
||||||
|
"count":12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item": "minecraft:sand"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"results" : [
|
||||||
|
{
|
||||||
|
"item": "minecraft:iron_ingot",
|
||||||
|
"count": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item": "techreborn:dark_ashes_dust"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -24,7 +24,10 @@
|
||||||
],
|
],
|
||||||
"libcd": [
|
"libcd": [
|
||||||
"techreborn.compat.libcd.LibCDPlugin"
|
"techreborn.compat.libcd.LibCDPlugin"
|
||||||
]
|
],
|
||||||
|
"autoswitch": [
|
||||||
|
"techreborn.compat.autoswitch.AutoSwitchApiImpl"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.6.3",
|
"fabricloader": ">=0.6.3",
|
||||||
|
|
Loading…
Add table
Reference in a new issue