This commit is contained in:
drcrazy 2019-07-27 01:52:51 +03:00
parent 4e1dfa0018
commit a7de6b428a
3 changed files with 30 additions and 29 deletions

View file

@ -50,7 +50,10 @@ public class AlarmBlockEntity extends BlockEntity
} }
public void rightClick() { public void rightClick() {
if (!world.isClient) { if (world.isClient) {
return;
}
if (selectedSound < 3) { if (selectedSound < 3) {
selectedSound++; selectedSound++;
} else { } else {
@ -59,7 +62,6 @@ public class AlarmBlockEntity extends BlockEntity
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new LiteralText( ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound)); Formatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
} }
}
// BlockEntity // BlockEntity
@Override @Override
@ -79,16 +81,16 @@ public class AlarmBlockEntity extends BlockEntity
super.fromTag(compound); super.fromTag(compound);
} }
//TODO 1.13 seems to be gone?
// @Override
// public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) {
// return false;
// }
// ITickable // ITickable
@Override @Override
public void tick() { public void tick() {
if (!world.isClient && world.getTime() % 25 == 0 && world.isReceivingRedstonePower(getPos())) { if (world.isClient()){
return;
}
if (world.getTime() % 25 != 0) {
return;
}
if (world.isReceivingRedstonePower(getPos())) {
BlockAlarm.setActive(true, world, pos); BlockAlarm.setActive(true, world, pos);
switch (selectedSound) { switch (selectedSound) {
case 1: case 1:
@ -101,8 +103,7 @@ public class AlarmBlockEntity extends BlockEntity
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.ALARM_3, SoundCategory.BLOCKS, 4F, 1F); world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.ALARM_3, SoundCategory.BLOCKS, 4F, 1F);
break; break;
} }
} else {
} else if (!world.isClient && world.getTime() % 25 == 0) {
BlockAlarm.setActive(false, world, pos); BlockAlarm.setActive(false, world, pos);
} }
} }

View file

@ -149,13 +149,13 @@ public class CableBlockEntity extends BlockEntity
return; return;
} }
Collections.shuffle(acceptors); Collections.shuffle(acceptors);
for (EnergyBlockEntity blockEntity : acceptors) { acceptors.forEach(blockEntity -> {
double drain = Math.min(energy, transferRate); double drain = Math.min(energy, transferRate);
if (drain > 0 && blockEntity.addEnergy(drain, true) > 0) { if (drain > 0 && blockEntity.addEnergy(drain, true) > 0) {
double move = blockEntity.addEnergy(drain, false); double move = blockEntity.addEnergy(drain, false);
useEnergy(move, false); useEnergy(move, false);
} }
} });
} }
// IListInfoProvider // IListInfoProvider

View file

@ -89,7 +89,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
@Override @Override
public boolean canAcceptEnergy(Direction direction) { public boolean canAcceptEnergy(Direction direction) {
if (IC2TransformersStyle == true){ if (IC2TransformersStyle){
return getFacingEnum() == direction; return getFacingEnum() == direction;
} }
return getFacingEnum() != direction; return getFacingEnum() != direction;
@ -97,7 +97,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
@Override @Override
public boolean canProvideEnergy(Direction direction) { public boolean canProvideEnergy(Direction direction) {
if (IC2TransformersStyle == true){ if (IC2TransformersStyle){
return getFacingEnum() != direction; return getFacingEnum() != direction;
} }
return getFacing() == direction; return getFacing() == direction;