Code cleanup

This commit is contained in:
Unknown 2018-07-21 01:37:00 +02:00 committed by unknown
parent 5a2630d80b
commit e63aae9a1b
19 changed files with 37 additions and 24 deletions

View file

@ -105,8 +105,10 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
world.setBlockState(blockPos, blockState.withProperty(BlockProperties.FACING, enumFacing));
}
// set inherited properties
final TileEntity tileEntity = world.getTileEntity(blockPos);
if (tileEntity != null && itemStack.getTagCompound() != null) {
assert tileEntity instanceof TileEntityAbstractBase;
if (itemStack.getTagCompound() != null) {
final NBTTagCompound tagCompound = itemStack.getTagCompound().copy();
tagCompound.setInteger("x", blockPos.getX());
tagCompound.setInteger("y", blockPos.getY());

View file

@ -21,7 +21,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@ -73,12 +72,12 @@ public class ItemBlockAbstractBase extends ItemBlock implements IItemBase {
public ITextComponent getStatus(final World world, @Nonnull final ItemStack itemStack) {
final IBlockState blockState;
if (world != null) {
if (world != null) {// in-game
assert Minecraft.getMinecraft().player != null;
blockState = block.getStateForPlacement(world, new BlockPos(0, -1, 0),
EnumFacing.DOWN, 0.0F, 0.0F, 0.0F,
itemStack.getMetadata(), Minecraft.getMinecraft().player, EnumHand.MAIN_HAND);
} else {
} else {// search tree
blockState = block.getStateFromMeta(itemStack.getMetadata());
}
@ -92,7 +91,7 @@ public class ItemBlockAbstractBase extends ItemBlock implements IItemBase {
}
@Override
public void onEntityExpireEvent(EntityItem entityItem, ItemStack itemStack) {
public void onEntityExpireEvent(final EntityItem entityItem, final ItemStack itemStack) {
}
@SideOnly(Side.CLIENT)

View file

@ -44,7 +44,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
// persistent properties
// (none)
// computer properties
// computed properties
private boolean isFirstTick = true;
private boolean isDirty = false;
@ -92,6 +92,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
@Override
public void onBlockUpdateDetected() {
assert Commons.isSafeThread();
}
protected <T extends Comparable<T>, V extends T> void updateBlockState(final IBlockState blockState_in, final IProperty<T> property, final V value) {

View file

@ -467,6 +467,7 @@ public abstract class TileEntityAbstractEnergy extends TileEntityAbstractInterfa
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
tagCompound = super.writeToNBT(tagCompound);
tagCompound.setLong(ENERGY_TAG, energy_getEnergyStored());
return tagCompound;
}

View file

@ -86,9 +86,11 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa
if (controlChannel == -1) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.control_channel.status_line.undefined");
} else if (controlChannel < CONTROL_CHANNEL_MIN || controlChannel > CONTROL_CHANNEL_MAX) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.control_channel.status_line.invalid", controlChannel);
return new WarpDriveText(Commons.styleWarning, "warpdrive.control_channel.status_line.invalid",
controlChannel);
} else {
return new WarpDriveText(Commons.styleCorrect, "warpdrive.control_channel.status_line.valid", controlChannel);
return new WarpDriveText(Commons.styleCorrect, "warpdrive.control_channel.status_line.valid",
controlChannel);
}
}

View file

@ -99,7 +99,9 @@ public abstract class TileEntityAbstractMiner extends TileEntityAbstractLaser {
exception.printStackTrace();
}
if (isSilkHarvestable) {
itemStackDrops.add(blockState.getBlock().getSilkTouchDrop(blockState));
// intended code if AccessTransformer was working with gradlew:
// itemStackDrops.add(blockState.getBlock().getSilkTouchDrop(blockState));
ItemStack itemStackDrop;
try {
itemStackDrop = (ItemStack) WarpDrive.methodBlock_getSilkTouch.invoke(blockState.getBlock(), blockState);

View file

@ -1,7 +1,6 @@
package cr0s.warpdrive.block.decoration;
import cr0s.warpdrive.block.BlockAbstractBase;
import cr0s.warpdrive.client.ClientProxy;
import cr0s.warpdrive.config.WarpDriveConfig;
import cr0s.warpdrive.data.BlockProperties;
import cr0s.warpdrive.data.EnumTier;
@ -11,7 +10,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
@ -76,15 +74,13 @@ public class BlockAbstractLamp extends BlockAbstractBase {
@SuppressWarnings("deprecation")
@Override
public boolean isOpaqueCube(final IBlockState state)
{
public boolean isOpaqueCube(final IBlockState state) {
return false;
}
@SuppressWarnings("deprecation")
@Override
public boolean isFullCube(final IBlockState state)
{
public boolean isFullCube(final IBlockState state) {
return false;
}

View file

@ -695,6 +695,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
tagCompound = super.writeToNBT(tagCompound);
tagCompound.setInteger("tier", tier.ordinal());
tagCompound.setBoolean("isEnabled", isEnabled);

View file

@ -3,7 +3,7 @@
"defaults": {
"model": "minecraft:cube_all",
"textures": {
"all": "warpdrive:blocks/component/highly_advanced_machine"
"all": "warpdrive:blocks/passive/highly_advanced_machine"
},
"transform": "forge:default-block"
},

View file

@ -3,7 +3,7 @@
"defaults": {
"model": "minecraft:cube_all",
"textures": {
"all": "warpdrive:blocks/component/iridium"
"all": "warpdrive:blocks/passive/iridium"
},
"transform": "forge:default-block"
},

View file

@ -188,11 +188,11 @@ item.warpdrive.tool.tuning_fork.black.name=Schwarze Stimmgabel
item.warpdrive.tool.tuning_fork.tooltip.usage=§bRecktsklicke einen Block§7 um seine Kristalle einzustellen\n§bSchleiche§7 um alternative Kristalle einzustellen
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass !!!
tile.warpdrive.decoration.decorative.energized.name=Energiegeladener Block
tile.warpdrive.decoration.decorative.network.name=Netzwerk Block
tile.warpdrive.decoration.decorative.plain.name=Ebenen Block
tile.warpdrive.decoration.gas.name=Gas Block
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass !!!
tile.warpdrive.decoration.lamp_bubble.name=Bubble Lamp !!!
tile.warpdrive.decoration.lamp_flat.name=Flat Lamp !!!
tile.warpdrive.decoration.lamp_long.name=Long Lamp !!!

View file

@ -185,11 +185,11 @@ item.warpdrive.tool.tuning_fork.black.name=Black Tuning Fork
item.warpdrive.tool.tuning_fork.tooltip.usage=§bRight click a block§7 to tune its crystals\n§bSneak§7 to tune alternate crystals
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass
tile.warpdrive.decoration.decorative.energized.name=Energized Block
tile.warpdrive.decoration.decorative.network.name=Network Block
tile.warpdrive.decoration.decorative.plain.name=Plain Block
tile.warpdrive.decoration.gas.name=Gas Block
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass
tile.warpdrive.decoration.lamp_bubble.name=Bubble Lamp
tile.warpdrive.decoration.lamp_flat.name=Flat Lamp
tile.warpdrive.decoration.lamp_long.name=Long Lamp

View file

@ -185,11 +185,11 @@ item.warpdrive.tool.tuning_fork.black.name=Diapason noir
item.warpdrive.tool.tuning_fork.tooltip.usage=§bCliques droit sur un block§r pour ajuster ses cristaux\n§bAccroupi§r pour ajuster les cristaux alternatifs
tile.warpdrive.decoration.bedrock_glass.name=Vitre de bedrock
tile.warpdrive.decoration.decorative.energized.name=Block energisé
tile.warpdrive.decoration.decorative.network.name=Bloc de réseau
tile.warpdrive.decoration.decorative.plain.name=Bloc ordinaire
tile.warpdrive.decoration.gas.name=Bloc de gaz
tile.warpdrive.decoration.bedrock_glass.name=Vitre de bedrock
tile.warpdrive.decoration.lamp_bubble.name=Lampe bulle
tile.warpdrive.decoration.lamp_flat.name=Lampe plate
tile.warpdrive.decoration.lamp_long.name=Lamp allongée

View file

@ -185,11 +185,14 @@ item.warpdrive.tool.tuning_fork.black.name=Zwarte Afstemmingsvork
item.warpdrive.tool.tuning_fork.tooltip.usage=§bRechts-klik op een blok§7 om zijn kristal af te stemmen\n§bbuk§7 om zijn andere kristallen af te stemmen
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass
tile.warpdrive.decoration.decorative.energized.name=Geactiveerd Blok
tile.warpdrive.decoration.decorative.network.name=Netwerk Blok
tile.warpdrive.decoration.decorative.plain.name=Oppervlaksblok
tile.warpdrive.decoration.gas.name=Gasblok
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass
tile.warpdrive.decoration.lamp_bubble.name=Bubble Lamp
tile.warpdrive.decoration.lamp_flat.name=Flat Lamp
tile.warpdrive.decoration.lamp_long.name=Long Lamp
tile.warpdrive.passive.iridium_block.name=Iridium Blok

View file

@ -185,11 +185,11 @@ item.warpdrive.tool.tuning_fork.black.name=Черный камертон
item.warpdrive.tool.tuning_fork.tooltip.usage=§bИспользуйте на блоке§7, чтобы настроить его кристаллы\n§bПрисядьте§7, чтобы настроить вторичные кристаллы
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass
tile.warpdrive.decoration.decorative.energized.name=Энергизированный блок
tile.warpdrive.decoration.decorative.network.name=Сетевой блок
tile.warpdrive.decoration.decorative.plain.name=Простой блок
tile.warpdrive.decoration.gas.name=Газ
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass
tile.warpdrive.decoration.lamp_bubble.name=Bubble Lamp
tile.warpdrive.decoration.lamp_flat.name=Flat Lamp
tile.warpdrive.decoration.lamp_long.name=Long Lamp

View file

@ -185,11 +185,14 @@ item.warpdrive.tool.tuning_fork.black.name=黑色音叉
item.warpdrive.tool.tuning_fork.tooltip.usage=§b右击方块§7调节水晶频率\n§b潜行右击§7轮替水晶
tile.warpdrive.decoration.bedrock_glass.name=基岩玻璃
tile.warpdrive.decoration.decorative.energized.name=能量方块
tile.warpdrive.decoration.decorative.network.name=网络方块
tile.warpdrive.decoration.decorative.plain.name=平坦方块
tile.warpdrive.decoration.gas.name=气密方块
tile.warpdrive.decoration.bedrock_glass.name=基岩玻璃
tile.warpdrive.decoration.lamp_bubble.name=Bubble Lamp
tile.warpdrive.decoration.lamp_flat.name=Flat Lamp
tile.warpdrive.decoration.lamp_long.name=Long Lamp
tile.warpdrive.passive.iridium_block.name=铱块

View file

@ -185,11 +185,14 @@ item.warpdrive.tool.tuning_fork.black.name=黑色調音叉
item.warpdrive.tool.tuning_fork.tooltip.usage=§b右鍵單擊一個方塊§7 以調整其水晶\n§b潛行§7 以調節交替水晶
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass
tile.warpdrive.decoration.decorative.energized.name=通電方塊
tile.warpdrive.decoration.decorative.network.name=網絡方塊
tile.warpdrive.decoration.decorative.plain.name=戰機方塊
tile.warpdrive.decoration.gas.name=氣體方塊
tile.warpdrive.decoration.bedrock_glass.name=Bedrock Glass
tile.warpdrive.decoration.lamp_bubble.name=Bubble Lamp
tile.warpdrive.decoration.lamp_flat.name=Flat Lamp
tile.warpdrive.decoration.lamp_long.name=Long Lamp
tile.warpdrive.passive.iridium_block.name=銥塊

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B