Merge remote-tracking branch 'origin/1.16' into 1.16

This commit is contained in:
modmuss50 2020-08-12 08:36:56 +01:00
commit bd88aabe68
6 changed files with 110 additions and 12 deletions

View file

@ -91,6 +91,8 @@ dependencies {
include rcVersion
modApi 'teamreborn:energy:0.1.0'
optionalDependency "com.github.dexman545:autoswitch-api:-SNAPSHOT"
}
def optionalDependency(String dep) {

View file

@ -102,8 +102,6 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
public BooleanProperty getProperty(Direction facing) {
switch (facing) {
case EAST:
return EAST;
case WEST:
return WEST;
case NORTH:
@ -120,18 +118,18 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
}
private BlockState makeConnections(World world, BlockPos pos) {
Boolean down = canConnectTo(world, pos.offset(Direction.DOWN, 1), Direction.UP);
Boolean up = canConnectTo(world, pos.up(), Direction.DOWN);
Boolean north = canConnectTo(world, pos.north(), Direction.SOUTH);
Boolean east = canConnectTo(world, pos.east(), Direction.WEST);
Boolean south = canConnectTo(world, pos.south(), Direction.NORTH);
Boolean west = canConnectTo(world, pos.west(), Direction.WEST);
Boolean down = canConnectTo(world, pos.down());
Boolean up = canConnectTo(world, pos.up());
Boolean north = canConnectTo(world, pos.north());
Boolean east = canConnectTo(world, pos.east());
Boolean south = canConnectTo(world, pos.south());
Boolean west = canConnectTo(world, pos.west());
return this.getDefaultState().with(DOWN, down).with(UP, up).with(NORTH, north).with(EAST, east)
.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);
if (blockEntity != null && (Energy.valid(blockEntity) || blockEntity instanceof CableBlockEntity)) {
return Boolean.TRUE;
@ -152,6 +150,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
}
// Block
@SuppressWarnings("deprecation")
@Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
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);
}
@SuppressWarnings("deprecation")
@Override
public BlockState getStateForNeighborUpdate(BlockState ourState, Direction ourFacing, BlockState otherState,
WorldAccess worldIn, BlockPos ourPos, BlockPos otherPos) {
if (ourState.get(WATERLOGGED)) {
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);
}
@SuppressWarnings("deprecation")
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext shapeContext) {
if (state.get(COVERED)) {
@ -217,6 +218,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
return cableShapeUtil.getShape(state);
}
@SuppressWarnings("deprecation")
@Override
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
super.onEntityCollision(state, worldIn, pos, entityIn);
@ -245,6 +247,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
entityIn.setOnFireFor(1);
}
entityIn.damage(new ElectrialShockSource(), 1F);
blockEntityCable.setEnergy(0d);
}
if (TechRebornConfig.uninsulatedElectrocutionSound) {
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);
}
@SuppressWarnings("deprecation")
@Override
public FluidState getFluidState(BlockState state) {
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);

View file

@ -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));
}
}

View file

@ -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"
}
]
}

View file

@ -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"
}
]
}

View file

@ -24,6 +24,9 @@
],
"libcd": [
"techreborn.compat.libcd.LibCDPlugin"
],
"autoswitch": [
"techreborn.compat.autoswitch.AutoSwitchApiImpl"
]
},
"depends": {