Skip to content

Commit

Permalink
Refactor packages; fix mapping crashes; fix UI textures
Browse files Browse the repository at this point in the history
  • Loading branch information
falseresync committed Jul 27, 2019
1 parent 2e6d651 commit 21a6877
Show file tree
Hide file tree
Showing 42 changed files with 168 additions and 150 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ Thumbs.db
.DS_Store
local.properties
.directory
**.png~
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

archivesBaseName = "vivatech"
version = "1.0.0-alpha.13+1.14.4"
version = "1.0.0-alpha.14+1.14.4"

repositories {
jcenter()
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/vivatech/api/block/AbstractMachineBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import vivatech.api.entity.AbstractMachineEntity;
import vivatech.api.block.entity.AbstractMachineBlockEntity;

public abstract class AbstractMachineBlock extends Block implements BlockEntityProvider, AttributeProvider {
public static final DirectionProperty FACING = Properties.HORIZONTAL_FACING;
Expand Down Expand Up @@ -55,8 +55,8 @@ public void onBlockRemoved(BlockState stateFrom, World world, BlockPos pos, Bloc
@Override
public void addAllAttributes(World world, BlockPos pos, BlockState state, AttributeList<?> to) {
BlockEntity be = world.getBlockEntity(pos);
if (be instanceof AbstractMachineEntity) {
to.offer(((AbstractMachineEntity) be).getEnergy());
if (be instanceof AbstractMachineBlockEntity) {
to.offer(((AbstractMachineBlockEntity) be).getEnergy());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivatech.api.entity;
package vivatech.api.block.entity;

import io.github.cottonmc.cotton.gui.PropertyDelegateHolder;
import io.github.cottonmc.energy.api.EnergyAttribute;
Expand All @@ -17,18 +17,18 @@
import vivatech.common.Vivatech;
import vivatech.api.block.AbstractMachineBlock;

public abstract class AbstractMachineEntity extends BlockEntity implements Tickable, SidedInventory, PropertyDelegateHolder,
public abstract class AbstractMachineBlockEntity extends BlockEntity implements Tickable, SidedInventory, PropertyDelegateHolder,
BlockEntityClientSerializable, EnergyAttributeProvider {
protected DefaultedList<ItemStack> inventory = DefaultedList.ofSize(getInvSize(), ItemStack.EMPTY);
protected SimpleEnergyAttribute energy = new SimpleEnergyAttribute(getMaxEnergy(), Vivatech.INFINITE_VOLTAGE) {
@Override
public boolean canInsertEnergy() { return AbstractMachineEntity.this.canInsertEnergy(); }
public boolean canInsertEnergy() { return AbstractMachineBlockEntity.this.canInsertEnergy(); }

@Override
public boolean canExtractEnergy() { return AbstractMachineEntity.this.canExtractEnergy(); }
public boolean canExtractEnergy() { return AbstractMachineBlockEntity.this.canExtractEnergy(); }
};

public AbstractMachineEntity(BlockEntityType<?> type) {
public AbstractMachineBlockEntity(BlockEntityType<?> type) {
super(type);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package vivatech.api.block.entity;

import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntityType;
import vivatech.api.block.ITieredBlock;
import vivatech.api.util.BlockTier;

public abstract class AbstractTieredMachineBlockEntity extends AbstractMachineBlockEntity implements ITieredBlockEntity {
public AbstractTieredMachineBlockEntity(BlockEntityType<?> type) {
super(type);
}

@Override
public BlockTier getTier() {
Block block = world.getBlockState(pos).getBlock();
if (block instanceof ITieredBlock) {
return ((ITieredBlock) block).getTier();
} else {
return BlockTier.MINIMAL;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package vivatech.api.block.entity;

public interface IConduitBlockEntity extends ITieredBlockEntity {
int BASE_TRANSFER_RATE = 50;

default int getTransferRate() {
return (int) (BASE_TRANSFER_RATE * getTier().getEnergyMultiplier());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package vivatech.api.block.entity;

import vivatech.api.util.BlockTier;

public interface ITieredBlockEntity {
BlockTier getTier();
}

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/vivatech/api/entity/IBlockEntity.java

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/java/vivatech/api/entity/ITieredEntity.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/vivatech/common/block/CoalGeneratorBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.world.World;
import vivatech.common.Vivatech;
import vivatech.api.block.AbstractMachineBlock;
import vivatech.common.entity.CoalGeneratorEntity;
import vivatech.common.block.entity.CoalGeneratorBlockEntity;

public class CoalGeneratorBlock extends AbstractMachineBlock {
public static final Identifier ID = new Identifier(Vivatech.MODID, "coal_generator");
Expand All @@ -34,6 +34,6 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
// BlockEntityProvider
@Override
public BlockEntity createBlockEntity(BlockView blockView) {
return new CoalGeneratorEntity();
return new CoalGeneratorBlockEntity();
}
}
4 changes: 2 additions & 2 deletions src/main/java/vivatech/common/block/CrusherBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.world.World;
import vivatech.common.Vivatech;
import vivatech.api.block.AbstractTieredMachineBlock;
import vivatech.common.entity.CrusherEntity;
import vivatech.common.block.entity.CrusherBlockEntity;
import vivatech.api.util.BlockTier;
import vivatech.util.TierHelper;

Expand All @@ -38,7 +38,7 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
// BlockEntityProvider
@Override
public BlockEntity createBlockEntity(BlockView blockView) {
return new CrusherEntity();
return new CrusherBlockEntity();
}

// ITieredBlock
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/vivatech/common/block/ElectricFurnaceBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.world.World;
import vivatech.common.Vivatech;
import vivatech.api.block.AbstractTieredMachineBlock;
import vivatech.common.entity.ElectricFurnaceEntity;
import vivatech.common.block.entity.ElectricFurnaceBlockEntity;
import vivatech.api.util.BlockTier;
import vivatech.util.TierHelper;

Expand All @@ -38,7 +38,7 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
// BlockEntityProvider
@Override
public BlockEntity createBlockEntity(BlockView blockView) {
return new ElectricFurnaceEntity();
return new ElectricFurnaceBlockEntity();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/vivatech/common/block/EnergyBankBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.world.World;
import vivatech.common.Vivatech;
import vivatech.api.block.AbstractMachineBlock;
import vivatech.common.entity.EnergyBankEntity;
import vivatech.common.block.entity.EnergyBankBlockEntity;

public class EnergyBankBlock extends AbstractMachineBlock {
public static final Identifier ID = new Identifier(Vivatech.MODID, "energy_bank");
Expand All @@ -34,6 +34,6 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
// BlockEntityProvider
@Override
public BlockEntity createBlockEntity(BlockView blockView) {
return new EnergyBankEntity();
return new EnergyBankBlockEntity();
}
}
4 changes: 2 additions & 2 deletions src/main/java/vivatech/common/block/EnergyConduitBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import vivatech.api.block.ITieredBlock;
import vivatech.api.util.BlockTier;
import vivatech.common.Vivatech;
import vivatech.common.entity.EnergyConduitEntity;
import vivatech.common.block.entity.EnergyConduitBlockEntity;
import vivatech.util.TierHelper;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -204,7 +204,7 @@ public boolean canConnect(Direction direction) {
@Nullable
@Override
public BlockEntity createBlockEntity(BlockView var1) {
return new EnergyConduitEntity();
return new EnergyConduitBlockEntity();
}

// ITieredBlock
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/vivatech/common/block/PressBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.world.World;
import vivatech.common.Vivatech;
import vivatech.api.block.AbstractTieredMachineBlock;
import vivatech.common.entity.PressEntity;
import vivatech.common.block.entity.PressBlockEntity;
import vivatech.api.util.BlockTier;
import vivatech.util.TierHelper;

Expand Down Expand Up @@ -43,6 +43,6 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
// BlockEntityProvider
@Override
public BlockEntity createBlockEntity(BlockView blockView) {
return new PressEntity();
return new PressBlockEntity();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivatech.common.entity;
package vivatech.common.block.entity;

import alexiil.mc.lib.attributes.Simulation;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
Expand All @@ -8,13 +8,13 @@
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.Direction;
import vivatech.common.Vivatech;
import vivatech.api.entity.AbstractMachineEntity;
import vivatech.api.block.entity.AbstractMachineBlockEntity;
import vivatech.common.init.VivatechEntities;
import vivatech.util.EnergyHelper;

import javax.annotation.Nullable;

public class CoalGeneratorEntity extends AbstractMachineEntity {
public class CoalGeneratorBlockEntity extends AbstractMachineBlockEntity {
private static final int GENERATE_PER_TICK = 1;
private static final int TICK_PER_GENERATE = 5;
private int burnTime = 0;
Expand Down Expand Up @@ -63,7 +63,7 @@ public int size() {
};


public CoalGeneratorEntity() {
public CoalGeneratorBlockEntity() {
super(VivatechEntities.COAL_GENERATOR);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivatech.common.entity;
package vivatech.common.block.entity;

import javax.annotation.Nullable;

Expand All @@ -8,13 +8,13 @@
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.Direction;
import vivatech.common.Vivatech;
import vivatech.api.entity.AbstractTieredMachineEntity;
import vivatech.api.block.entity.AbstractTieredMachineBlockEntity;
import vivatech.common.init.VivatechEntities;
import vivatech.common.init.VivatechRecipes;
import vivatech.common.recipe.CrushingRecipe;
import vivatech.api.util.BlockTier;

public class CrusherEntity extends AbstractTieredMachineEntity {
public class CrusherBlockEntity extends AbstractTieredMachineBlockEntity {

public static final int CONSUME_PER_TICK = 1;
public static final int TICK_PER_CONSUME = 5;
Expand Down Expand Up @@ -63,7 +63,7 @@ public int size() {
}
};

public CrusherEntity() {
public CrusherBlockEntity() {
super(VivatechEntities.CRUSHER);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivatech.common.entity;
package vivatech.common.block.entity;

import javax.annotation.Nullable;

Expand All @@ -11,11 +11,11 @@
import net.minecraft.recipe.SmeltingRecipe;
import net.minecraft.util.math.Direction;
import vivatech.common.Vivatech;
import vivatech.api.entity.AbstractTieredMachineEntity;
import vivatech.api.block.entity.AbstractTieredMachineBlockEntity;
import vivatech.common.init.VivatechEntities;
import vivatech.api.util.BlockTier;

public class ElectricFurnaceEntity extends AbstractTieredMachineEntity {
public class ElectricFurnaceBlockEntity extends AbstractTieredMachineBlockEntity {
private static final int TICK_PER_CONSUME = 5;
private static final int CONSUME_PER_TICK = 2;
private int cookTime = 0;
Expand Down Expand Up @@ -63,7 +63,7 @@ public int size() {
}
};

public ElectricFurnaceEntity() {
public ElectricFurnaceBlockEntity() {
super(VivatechEntities.ELECTRIC_FURNACE);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package vivatech.common.entity;
package vivatech.common.block.entity;

import io.github.cottonmc.energy.api.EnergyAttribute;
import io.github.cottonmc.energy.api.EnergyAttributeProviderItem;
import net.minecraft.container.PropertyDelegate;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Direction;
import vivatech.api.entity.AbstractMachineEntity;
import vivatech.api.block.entity.AbstractMachineBlockEntity;
import vivatech.common.init.VivatechEntities;
import vivatech.util.EnergyHelper;

import javax.annotation.Nullable;

public class EnergyBankEntity extends AbstractMachineEntity {
public class EnergyBankBlockEntity extends AbstractMachineBlockEntity {

private static final int TRANSFER_PER_TICK = 4;
private final PropertyDelegate propertyDelegate = new PropertyDelegate() {
Expand Down Expand Up @@ -47,7 +47,7 @@ public int size() {
}
};

public EnergyBankEntity() {
public EnergyBankBlockEntity() {
super(VivatechEntities.ENERGY_BANK);
}

Expand Down
Loading

0 comments on commit 21a6877

Please sign in to comment.