1.14/1.15: Slab Slice placement improved. Major refractoring to the 1.13+ naming conventions. 1.12: Moved static Crate UI constants (related to issue 91).

This commit is contained in:
stfwi 2020-04-30 15:56:07 +02:00
parent dea1363f8e
commit 4c2755d915
92 changed files with 3237 additions and 3050 deletions

View file

@ -4,4 +4,4 @@ org.gradle.jvmargs=-Xmx8G
version_minecraft=1.12.2 version_minecraft=1.12.2
version_forge=14.23.5.2768 version_forge=14.23.5.2768
version_jei=4.10.0.198 version_jei=4.10.0.198
version_engineersdecor=1.0.20-b5 version_engineersdecor=1.0.20-b6

View file

@ -1,6 +1,7 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.12.2": { "1.12.2": {
"1.0.20-b6": "[F] Implemented compat related to issue #91.",
"1.0.20-b5": "[A] Back-ported Patchouli based Manual (you need to install Vazkii_'s Patchouli, too).\n[A] Back-ported Steel Mesh Fence Gate.\n[M] Minor back-porting compatibility refractoring.", "1.0.20-b5": "[A] Back-ported Patchouli based Manual (you need to install Vazkii_'s Patchouli, too).\n[A] Back-ported Steel Mesh Fence Gate.\n[M] Minor back-porting compatibility refractoring.",
"1.0.20-b4": "[F] Fixed TE registration bug for Crate registry-optout (issue #91, thx tyon2006).", "1.0.20-b4": "[F] Fixed TE registration bug for Crate registry-optout (issue #91, thx tyon2006).",
"1.0.20-b3": "[/] Version skipped for 1.12.2.", "1.0.20-b3": "[/] Version skipped for 1.12.2.",
@ -87,6 +88,6 @@
}, },
"promos": { "promos": {
"1.12.2-recommended": "1.0.19", "1.12.2-recommended": "1.0.19",
"1.12.2-latest": "1.0.20-b5" "1.12.2-latest": "1.0.20-b6"
} }
} }

View file

@ -10,6 +10,8 @@ Mod sources for Minecraft version 1.12.2.
---- ----
## Version history ## Version history
- v1.0.20-b6 [F] Implemented compat related to issue #91.
- v1.0.20-b5 [A] Back-ported Patchouli based Manual (you need to install Vazkii_'s Patchouli, too). - v1.0.20-b5 [A] Back-ported Patchouli based Manual (you need to install Vazkii_'s Patchouli, too).
[A] Back-ported Steel Mesh Fence Gate. [A] Back-ported Steel Mesh Fence Gate.
[M] Minor back-porting compatibility refractoring. [M] Minor back-porting compatibility refractoring.

View file

@ -12,7 +12,6 @@
*/ */
package wile.engineersdecor; package wile.engineersdecor;
import net.minecraft.block.BlockDragonEgg;
import wile.engineersdecor.blocks.*; import wile.engineersdecor.blocks.*;
import wile.engineersdecor.detail.ModAuxiliaries; import wile.engineersdecor.detail.ModAuxiliaries;
import wile.engineersdecor.detail.ModConfig; import wile.engineersdecor.detail.ModConfig;

View file

@ -352,20 +352,6 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private static class BGui extends GuiContainer private static class BGui extends GuiContainer
{ {
protected static final int BUTTON_NEXT = 0;
protected static final int BUTTON_PREV = 1;
protected static final int BUTTON_CLEAR_GRID = 2;
protected static final int BUTTON_NEXT_COLLISION_RECIPE = 3;
protected static final int BUTTON_FROM_STORAGE = 4;
protected static final int BUTTON_TO_STORAGE = 5;
protected static final int BUTTON_FROM_PLAYER = 6;
protected static final int BUTTON_TO_PLAYER = 7;
protected static final int ACTION_PLACE_CURRENT_HISTORY_SEL = 8;
protected static final int ACTION_PLACE_SHIFTCLICKED_STACK = 9;
protected static final int ACTION_MOVE_ALL_STACKS = 10;
protected static final int ACTION_INCREASE_CRAFTING_STACKS = 11;
protected static final int ACTION_DECREASE_CRAFTING_STACKS = 12;
protected static final ResourceLocation BACKGROUND = new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/treated_wood_crafting_table.png"); protected static final ResourceLocation BACKGROUND = new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/treated_wood_crafting_table.png");
protected final BTileEntity te; protected final BTileEntity te;
protected final EntityPlayer player; protected final EntityPlayer player;
@ -383,15 +369,15 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
final int x0=((width - xSize)/2), y0=((height - ySize)/2); final int x0=((width - xSize)/2), y0=((height - ySize)/2);
buttons.clear(); buttons.clear();
if(with_assist) { if(with_assist) {
buttons.add(addButton(new GuiButtonImage(BUTTON_NEXT, x0+158,y0+44, 12,12, 194,44, 12, BACKGROUND))); buttons.add(addButton(new GuiButtonImage(BContainer.BUTTON_NEXT, x0+158,y0+44, 12,12, 194,44, 12, BACKGROUND)));
buttons.add(addButton(new GuiButtonImage(BUTTON_PREV, x0+158,y0+30, 12,12, 180,30, 12, BACKGROUND))); buttons.add(addButton(new GuiButtonImage(BContainer.BUTTON_PREV, x0+158,y0+30, 12,12, 180,30, 12, BACKGROUND)));
buttons.add(addButton(new GuiButtonImage(BUTTON_CLEAR_GRID, x0+158,y0+58, 12,12, 194,8, 12, BACKGROUND))); buttons.add(addButton(new GuiButtonImage(BContainer.BUTTON_CLEAR_GRID, x0+158,y0+58, 12,12, 194,8, 12, BACKGROUND)));
buttons.add(addButton(new GuiButtonImage(BUTTON_NEXT_COLLISION_RECIPE, x0+132,y0+18, 20,10, 183,95, 12, BACKGROUND))); buttons.add(addButton(new GuiButtonImage(BContainer.BUTTON_NEXT_COLLISION_RECIPE, x0+132,y0+18, 20,10, 183,95, 12, BACKGROUND)));
if(with_assist_quickmove_buttons) { if(with_assist_quickmove_buttons) {
buttons.add(addButton(new GuiButtonImage(BUTTON_FROM_STORAGE, x0+49, y0+34, 9,17, 219,34, 17, BACKGROUND))); buttons.add(addButton(new GuiButtonImage(BContainer.BUTTON_FROM_STORAGE, x0+49, y0+34, 9,17, 219,34, 17, BACKGROUND)));
buttons.add(addButton(new GuiButtonImage(BUTTON_TO_STORAGE, x0+49, y0+52, 9,17, 208,16, 17, BACKGROUND))); buttons.add(addButton(new GuiButtonImage(BContainer.BUTTON_TO_STORAGE, x0+49, y0+52, 9,17, 208,16, 17, BACKGROUND)));
buttons.add(addButton(new GuiButtonImage(BUTTON_FROM_PLAYER, x0+77, y0+71, 17,9, 198,71, 9, BACKGROUND))); buttons.add(addButton(new GuiButtonImage(BContainer.BUTTON_FROM_PLAYER, x0+77, y0+71, 17,9, 198,71, 9, BACKGROUND)));
buttons.add(addButton(new GuiButtonImage(BUTTON_TO_PLAYER, x0+59, y0+71, 17,9, 180,71, 9, BACKGROUND))); buttons.add(addButton(new GuiButtonImage(BContainer.BUTTON_TO_PLAYER, x0+59, y0+71, 17,9, 180,71, 9, BACKGROUND)));
} }
} }
} }
@ -412,8 +398,8 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
public void drawScreen(int mouseX, int mouseY, float partialTicks) public void drawScreen(int mouseX, int mouseY, float partialTicks)
{ {
if(with_assist) { if(with_assist) {
buttons.get(BUTTON_NEXT_COLLISION_RECIPE).visible = te.has_recipe_collision(); buttons.get(BContainer.BUTTON_NEXT_COLLISION_RECIPE).visible = te.has_recipe_collision();
buttons.get(BUTTON_NEXT_COLLISION_RECIPE).enabled = te.has_recipe_collision(); buttons.get(BContainer.BUTTON_NEXT_COLLISION_RECIPE).enabled = te.has_recipe_collision();
} }
drawDefaultBackground(); drawDefaultBackground();
super.drawScreen(mouseX, mouseY, partialTicks); super.drawScreen(mouseX, mouseY, partialTicks);
@ -503,15 +489,15 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
protected void actionPerformed(GuiButton button) protected void actionPerformed(GuiButton button)
{ {
switch(button.id) { switch(button.id) {
case BUTTON_NEXT: case BContainer.BUTTON_NEXT:
case BUTTON_PREV: case BContainer.BUTTON_PREV:
case BUTTON_CLEAR_GRID: case BContainer.BUTTON_CLEAR_GRID:
case BUTTON_FROM_STORAGE: case BContainer.BUTTON_FROM_STORAGE:
case BUTTON_TO_STORAGE: case BContainer.BUTTON_TO_STORAGE:
case BUTTON_FROM_PLAYER: case BContainer.BUTTON_FROM_PLAYER:
case BUTTON_TO_PLAYER: case BContainer.BUTTON_TO_PLAYER:
case ACTION_PLACE_CURRENT_HISTORY_SEL: case BContainer.ACTION_PLACE_CURRENT_HISTORY_SEL:
case BUTTON_NEXT_COLLISION_RECIPE: { case BContainer.BUTTON_NEXT_COLLISION_RECIPE: {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("action", button.id); nbt.setInteger("action", button.id);
Networking.PacketTileNotify.sendToServer(te, nbt); Networking.PacketTileNotify.sendToServer(te, nbt);
@ -548,7 +534,7 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
if(palce_in_crafting_grid) { if(palce_in_crafting_grid) {
// Explicit grid placement. // Explicit grid placement.
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("action", ACTION_PLACE_SHIFTCLICKED_STACK); nbt.setInteger("action", BContainer.ACTION_PLACE_SHIFTCLICKED_STACK);
nbt.setInteger("containerslot", slotId); nbt.setInteger("containerslot", slotId);
if(ModAuxiliaries.isCtrlDown()) nbt.setBoolean("move-all", true); if(ModAuxiliaries.isCtrlDown()) nbt.setBoolean("move-all", true);
Networking.PacketTileNotify.sendToServer(te, nbt); Networking.PacketTileNotify.sendToServer(te, nbt);
@ -557,7 +543,7 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
// Move all same items from the inventory of the clicked slot // Move all same items from the inventory of the clicked slot
// (or the crafting grid) to the corresponding target inventory. // (or the crafting grid) to the corresponding target inventory.
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("action", ACTION_MOVE_ALL_STACKS); nbt.setInteger("action", BContainer.ACTION_MOVE_ALL_STACKS);
nbt.setInteger("containerslot", slotId); nbt.setInteger("containerslot", slotId);
Networking.PacketTileNotify.sendToServer(te, nbt); Networking.PacketTileNotify.sendToServer(te, nbt);
return; return;
@ -579,20 +565,20 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
if(count > 0) { if(count > 0) {
if((count < resultSlot.getStack().getMaxStackSize()) && (count < resultSlot.getSlotStackLimit())) { if((count < resultSlot.getStack().getMaxStackSize()) && (count < resultSlot.getSlotStackLimit())) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("action", ACTION_INCREASE_CRAFTING_STACKS); nbt.setInteger("action", BContainer.ACTION_INCREASE_CRAFTING_STACKS);
if(limit > 1) nbt.setInteger("limit", limit); if(limit > 1) nbt.setInteger("limit", limit);
Networking.PacketTileNotify.sendToServer(te, nbt); Networking.PacketTileNotify.sendToServer(te, nbt);
} }
} else if(!te.history.current().isEmpty()) { } else if(!te.history.current().isEmpty()) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("action", ACTION_PLACE_CURRENT_HISTORY_SEL); nbt.setInteger("action", BContainer.ACTION_PLACE_CURRENT_HISTORY_SEL);
Networking.PacketTileNotify.sendToServer(te, nbt); Networking.PacketTileNotify.sendToServer(te, nbt);
} }
} else if(wheel_inc < 0) { } else if(wheel_inc < 0) {
if(count > 0) { if(count > 0) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
if(limit > 1) nbt.setInteger("limit", limit); if(limit > 1) nbt.setInteger("limit", limit);
nbt.setInteger("action", ACTION_DECREASE_CRAFTING_STACKS); nbt.setInteger("action", BContainer.ACTION_DECREASE_CRAFTING_STACKS);
Networking.PacketTileNotify.sendToServer(te, nbt); Networking.PacketTileNotify.sendToServer(te, nbt);
} }
} }
@ -605,7 +591,7 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
final Slot resultSlot = this.getSlotUnderMouse(); // double check final Slot resultSlot = this.getSlotUnderMouse(); // double check
if(!(resultSlot instanceof BSlotCrafting)) return; if(!(resultSlot instanceof BSlotCrafting)) return;
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("action", ACTION_PLACE_CURRENT_HISTORY_SEL); nbt.setInteger("action", BContainer.ACTION_PLACE_CURRENT_HISTORY_SEL);
Networking.PacketTileNotify.sendToServer(te, nbt); Networking.PacketTileNotify.sendToServer(te, nbt);
} }
} }
@ -644,6 +630,21 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
public static class BContainer extends Container public static class BContainer extends Container
{ {
protected static final int BUTTON_NEXT = 0;
protected static final int BUTTON_PREV = 1;
protected static final int BUTTON_CLEAR_GRID = 2;
protected static final int BUTTON_NEXT_COLLISION_RECIPE = 3;
protected static final int BUTTON_FROM_STORAGE = 4;
protected static final int BUTTON_TO_STORAGE = 5;
protected static final int BUTTON_FROM_PLAYER = 6;
protected static final int BUTTON_TO_PLAYER = 7;
protected static final int ACTION_PLACE_CURRENT_HISTORY_SEL = 8;
protected static final int ACTION_PLACE_SHIFTCLICKED_STACK = 9;
protected static final int ACTION_MOVE_ALL_STACKS = 10;
protected static final int ACTION_INCREASE_CRAFTING_STACKS = 11;
protected static final int ACTION_DECREASE_CRAFTING_STACKS = 12;
private final World world; private final World world;
private final BlockPos pos; private final BlockPos pos;
private final EntityPlayer player; private final EntityPlayer player;
@ -1287,39 +1288,39 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
boolean player_inventory_changed = false; boolean player_inventory_changed = false;
if(with_assist && nbt.hasKey("action")) { if(with_assist && nbt.hasKey("action")) {
switch(nbt.getInteger("action")) { switch(nbt.getInteger("action")) {
case BGui.BUTTON_NEXT: { case BContainer.BUTTON_NEXT: {
history.next(); history.next();
syncHistory(player); syncHistory(player);
// implicitly clear the grid, so that the player can see the refab, and that no recipe is active. // implicitly clear the grid, so that the player can see the refab, and that no recipe is active.
if(clear_grid_to_player(player)) { te_changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { te_changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) te_changed = true; if(clear_grid_to_storage(player)) te_changed = true;
} break; } break;
case BGui.BUTTON_PREV: { case BContainer.BUTTON_PREV: {
history.prev(); history.prev();
syncHistory(player); syncHistory(player);
if(clear_grid_to_player(player)) { te_changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { te_changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) te_changed = true; if(clear_grid_to_storage(player)) te_changed = true;
} break; } break;
case BGui.BUTTON_CLEAR_GRID: { case BContainer.BUTTON_CLEAR_GRID: {
history.reset_selection(); history.reset_selection();
syncHistory(player); syncHistory(player);
if(clear_grid_to_player(player)) { te_changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { te_changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) te_changed = true; if(clear_grid_to_storage(player)) te_changed = true;
} break; } break;
case BGui.BUTTON_TO_STORAGE: { case BContainer.BUTTON_TO_STORAGE: {
if(clear_grid_to_storage(player)) te_changed = true; if(clear_grid_to_storage(player)) te_changed = true;
} break; } break;
case BGui.BUTTON_TO_PLAYER: { case BContainer.BUTTON_TO_PLAYER: {
if(clear_grid_to_player(player)) { te_changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { te_changed = true; player_inventory_changed = true; }
} break; } break;
case BGui.BUTTON_FROM_STORAGE: { case BContainer.BUTTON_FROM_STORAGE: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(this, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS) new SlotRange(this, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS)
}, refab_crafting_stacks(), player) != PlacementResult.UNCHANGED) { }, refab_crafting_stacks(), player) != PlacementResult.UNCHANGED) {
te_changed = true; te_changed = true;
} }
} break; } break;
case BGui.BUTTON_FROM_PLAYER: { case BContainer.BUTTON_FROM_PLAYER: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9) new SlotRange(player.inventory, 0, 9)
@ -1327,7 +1328,7 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
te_changed = true; player_inventory_changed = true; te_changed = true; player_inventory_changed = true;
} }
} break; } break;
case BGui.ACTION_PLACE_CURRENT_HISTORY_SEL: { case BContainer.ACTION_PLACE_CURRENT_HISTORY_SEL: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
@ -1336,7 +1337,7 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
te_changed = true; te_changed = true;
} }
} break; } break;
case BGui.ACTION_PLACE_SHIFTCLICKED_STACK: { case BContainer.ACTION_PLACE_SHIFTCLICKED_STACK: {
final int container_slot_id = nbt.getInteger("containerslot"); final int container_slot_id = nbt.getInteger("containerslot");
if((container_slot_id < 10) || (container_slot_id > 53)) { if((container_slot_id < 10) || (container_slot_id > 53)) {
break; // out of range break; // out of range
@ -1363,7 +1364,7 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
} }
} }
} break; } break;
case BGui.ACTION_MOVE_ALL_STACKS: { case BContainer.ACTION_MOVE_ALL_STACKS: {
final int container_slot_id = nbt.getInteger("containerslot"); final int container_slot_id = nbt.getInteger("containerslot");
if((container_slot_id < 1) || (container_slot_id > 53)) { if((container_slot_id < 1) || (container_slot_id > 53)) {
break; // out of range break; // out of range
@ -1408,19 +1409,19 @@ public class BlockDecorCraftingTable extends BlockDecorDirected
} }
} }
} break; } break;
case BGui.BUTTON_NEXT_COLLISION_RECIPE: { case BContainer.BUTTON_NEXT_COLLISION_RECIPE: {
if(player.openContainer instanceof BContainer) { if(player.openContainer instanceof BContainer) {
((BContainer)player.openContainer).select_next_collision_recipe(this, player); ((BContainer)player.openContainer).select_next_collision_recipe(this, player);
} }
} break; } break;
case BGui.ACTION_DECREASE_CRAFTING_STACKS: { case BContainer.ACTION_DECREASE_CRAFTING_STACKS: {
te_changed = player_inventory_changed = decrease_grid_stacks(new SlotRange[]{ te_changed = player_inventory_changed = decrease_grid_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),
new SlotRange(this, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS) new SlotRange(this, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS)
}, MathHelper.clamp(nbt.getInteger("limit"), 1, 8)); }, MathHelper.clamp(nbt.getInteger("limit"), 1, 8));
} break; } break;
case BGui.ACTION_INCREASE_CRAFTING_STACKS: { case BContainer.ACTION_INCREASE_CRAFTING_STACKS: {
te_changed = player_inventory_changed = increase_grid_stacks(new SlotRange[]{ te_changed = player_inventory_changed = increase_grid_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),

View file

@ -5,4 +5,4 @@ version_minecraft=1.14.4
version_forge_minecraft=1.14.4-28.2.3 version_forge_minecraft=1.14.4-28.2.3
version_fml_mappings=20190719-1.14.3 version_fml_mappings=20190719-1.14.3
version_jei=1.14.4:6.0.0.10 version_jei=1.14.4:6.0.0.10
version_engineersdecor=1.0.20-b5 version_engineersdecor=1.0.20-b6

View file

@ -1,6 +1,7 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.14.4": { "1.14.4": {
"1.0.20-b6": "[M] Slab Slice placement improved.\n[M] Quite some naming/refractoring under the hood.",
"1.0.20-b5": "[A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a Hopper is placed in the auxiliary slot.\n[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.", "1.0.20-b5": "[A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a Hopper is placed in the auxiliary slot.\n[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.",
"1.0.20-b4": "[F] Fixed Mineral Smelter fluid voiding on external draining (issue #92, thx papaworld, pupnewfster).", "1.0.20-b4": "[F] Fixed Mineral Smelter fluid voiding on external draining (issue #92, thx papaworld, pupnewfster).",
"1.0.20-b3": "[M] Labeled Crate: GUI quick-move-all (ctrl-shift click) smart move tweaked, Manual page added.\n[F] Fixed IE ingredients based default recipes for Factory Dropper and Small Electrical Furnace.\n[M] Factory Hopper: GUI quick-move-all added.\n[M] Code structure, simplifications, cap invalidation fixes.\n[M] Valves: Removed performance caching for testing purposes.", "1.0.20-b3": "[M] Labeled Crate: GUI quick-move-all (ctrl-shift click) smart move tweaked, Manual page added.\n[F] Fixed IE ingredients based default recipes for Factory Dropper and Small Electrical Furnace.\n[M] Factory Hopper: GUI quick-move-all added.\n[M] Code structure, simplifications, cap invalidation fixes.\n[M] Valves: Removed performance caching for testing purposes.",
@ -54,6 +55,6 @@
}, },
"promos": { "promos": {
"1.14.4-recommended": "", "1.14.4-recommended": "",
"1.14.4-latest": "1.0.20-b5" "1.14.4-latest": "1.0.20-b6"
} }
} }

View file

@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.14.4.
## Version history ## Version history
- v1.0.20-b6 [M] Slab Slice placement improved.
[M] Quite some naming/refractoring under the hood.
- v1.0.20-b5 [A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a - v1.0.20-b5 [A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a
Hopper is placed in the auxiliary slot. Hopper is placed in the auxiliary slot.
[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label. [M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.

View file

@ -7,10 +7,8 @@
* Main class for module settings. Handles reading and * Main class for module settings. Handles reading and
* saving the config file. * saving the config file.
*/ */
package wile.engineersdecor.detail; package wile.engineersdecor;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.*; import wile.engineersdecor.blocks.*;
import wile.engineersdecor.libmc.blocks.StandardBlocks; import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
@ -417,14 +415,14 @@ public class ModConfig
.comment("Defines, in percent, how fast the electrical furnace smelts compared to " + .comment("Defines, in percent, how fast the electrical furnace smelts compared to " +
"a vanilla furnace. 100% means vanilla furnace speed, 150% means the " + "a vanilla furnace. 100% means vanilla furnace speed, 150% means the " +
"electrical furnace is faster. The value can be changed on-the-fly for tuning.") "electrical furnace is faster. The value can be changed on-the-fly for tuning.")
.defineInRange("e_furnace_speed_percent", BlockDecorFurnaceElectrical.DecorFurnaceElectrical.DEFAULT_SPEED_PERCENT, 50, 800); .defineInRange("e_furnace_speed_percent", EdElectricalFurnace.ElectricalFurnaceTileEntity.DEFAULT_SPEED_PERCENT, 50, 800);
e_furnace_power_consumption = builder e_furnace_power_consumption = builder
.translation(ModEngineersDecor.MODID + ".config.e_furnace_power_consumption") .translation(ModEngineersDecor.MODID + ".config.e_furnace_power_consumption")
.comment("Defines how much RF per tick the the electrical furnace consumed (average) for smelting. " + .comment("Defines how much RF per tick the the electrical furnace consumed (average) for smelting. " +
"The feeders transferring items from/to adjacent have this consumption/8 for each stack transaction. " + "The feeders transferring items from/to adjacent have this consumption/8 for each stack transaction. " +
"The default value is only slightly higher than a furnace with an IE external heater (and no burning fuel inside)." + "The default value is only slightly higher than a furnace with an IE external heater (and no burning fuel inside)." +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("e_furnace_power_consumption", BlockDecorFurnaceElectrical.DecorFurnaceElectrical.DEFAULT_ENERGY_CONSUMPTION, 8, 4096); .defineInRange("e_furnace_power_consumption", EdElectricalFurnace.ElectricalFurnaceTileEntity.DEFAULT_ENERGY_CONSUMPTION, 8, 4096);
e_furnace_automatic_pulling = builder e_furnace_automatic_pulling = builder
.translation(ModEngineersDecor.MODID + ".config.e_furnace_automatic_pulling") .translation(ModEngineersDecor.MODID + ".config.e_furnace_automatic_pulling")
.comment("Defines if the electrical furnace automatically pulls items from an inventory at the input side." + .comment("Defines if the electrical furnace automatically pulls items from an inventory at the input side." +
@ -436,24 +434,24 @@ public class ModConfig
"Note that the agerage power is much less, as no power is produced at all during the night, " + "Note that the agerage power is much less, as no power is produced at all during the night, " +
"and the power curve is nonlinear rising/falling during the day. Bad weather conditions also " + "and the power curve is nonlinear rising/falling during the day. Bad weather conditions also " +
"decrease the production. The config value can be changed on-the-fly for tuning.") "decrease the production. The config value can be changed on-the-fly for tuning.")
.defineInRange("small_solar_panel_peak_production", BlockDecorSolarPanel.BTileEntity.DEFAULT_PEAK_POWER, 2, 4096); .defineInRange("small_solar_panel_peak_production", EdSolarPanel.SolarPanelTileEntity.DEFAULT_PEAK_POWER, 2, 4096);
block_breaker_power_consumption = builder block_breaker_power_consumption = builder
.translation(ModEngineersDecor.MODID + ".config.block_breaker_power_consumption") .translation(ModEngineersDecor.MODID + ".config.block_breaker_power_consumption")
.comment("Defines how much RF power the Small Block Breaker requires to magnificently increase the processing speed. " + .comment("Defines how much RF power the Small Block Breaker requires to magnificently increase the processing speed. " +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("block_breaker_power_consumption", BlockDecorBreaker.BTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024); .defineInRange("block_breaker_power_consumption", EdBreaker.BreakerTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024);
block_breaker_reluctance = builder block_breaker_reluctance = builder
.translation(ModEngineersDecor.MODID + ".config.block_breaker_reluctance") .translation(ModEngineersDecor.MODID + ".config.block_breaker_reluctance")
.comment("Defines how much time the Small Block Breaker needs per block hardness, " + .comment("Defines how much time the Small Block Breaker needs per block hardness, " +
"means: 'reluctance' * hardness + min_time, you change the 'reluctance' here." + "means: 'reluctance' * hardness + min_time, you change the 'reluctance' here." +
"The unit is ticks/hardness. " + "The config value can be changed on-the-fly for tuning.") "The unit is ticks/hardness. " + "The config value can be changed on-the-fly for tuning.")
.defineInRange("block_breaker_reluctance", BlockDecorBreaker.BTileEntity.DEFAULT_BREAKING_RELUCTANCE, 5, 50); .defineInRange("block_breaker_reluctance", EdBreaker.BreakerTileEntity.DEFAULT_BREAKING_RELUCTANCE, 5, 50);
block_breaker_min_breaking_time = builder block_breaker_min_breaking_time = builder
.translation(ModEngineersDecor.MODID + ".config.block_breaker_min_breaking_time") .translation(ModEngineersDecor.MODID + ".config.block_breaker_min_breaking_time")
.comment("Defines how much time the Small Block Breaker needs at least, better said it's an offset: " + .comment("Defines how much time the Small Block Breaker needs at least, better said it's an offset: " +
"'reluctance' * hardness + min_time, you change the 'min_time' here, value " + "'reluctance' * hardness + min_time, you change the 'min_time' here, value " +
"in ticks." + "The config value can be changed on-the-fly for tuning.") "in ticks." + "The config value can be changed on-the-fly for tuning.")
.defineInRange("block_breaker_min_breaking_time", BlockDecorBreaker.BTileEntity.DEFAULT_MIN_BREAKING_TIME, 10, 100); .defineInRange("block_breaker_min_breaking_time", EdBreaker.BreakerTileEntity.DEFAULT_MIN_BREAKING_TIME, 10, 100);
block_breaker_requires_power = builder block_breaker_requires_power = builder
.translation(ModEngineersDecor.MODID + ".config.block_breaker_requires_power") .translation(ModEngineersDecor.MODID + ".config.block_breaker_requires_power")
.comment("Defines if the Small Block Breaker does not work without RF power.") .comment("Defines if the Small Block Breaker does not work without RF power.")
@ -462,13 +460,13 @@ public class ModConfig
.translation(ModEngineersDecor.MODID + ".config.tree_cuttter_energy_consumption") .translation(ModEngineersDecor.MODID + ".config.tree_cuttter_energy_consumption")
.comment("Defines how much RF power the Small Tree Cutter requires to magnificently increase the processing speed. " + .comment("Defines how much RF power the Small Tree Cutter requires to magnificently increase the processing speed. " +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("tree_cuttter_energy_consumption", BlockDecorTreeCutter.BTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024); .defineInRange("tree_cuttter_energy_consumption", EdTreeCutter.TreeCutterTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024);
tree_cuttter_cutting_time_needed = builder tree_cuttter_cutting_time_needed = builder
.translation(ModEngineersDecor.MODID + ".config.tree_cuttter_cutting_time_needed") .translation(ModEngineersDecor.MODID + ".config.tree_cuttter_cutting_time_needed")
.comment("Defines how much time the Small Tree Cutter needs to cut a tree without RF power. " + .comment("Defines how much time the Small Tree Cutter needs to cut a tree without RF power. " +
"The value is in seconds. With energy it is 6 times faster. " + "The value is in seconds. With energy it is 6 times faster. " +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("tree_cuttter_cutting_time_needed", BlockDecorTreeCutter.BTileEntity.DEFAULT_CUTTING_TIME_NEEDED, 10, 240); .defineInRange("tree_cuttter_cutting_time_needed", EdTreeCutter.TreeCutterTileEntity.DEFAULT_CUTTING_TIME_NEEDED, 10, 240);
tree_cuttter_requires_power = builder tree_cuttter_requires_power = builder
.translation(ModEngineersDecor.MODID + ".config.tree_cuttter_requires_power") .translation(ModEngineersDecor.MODID + ".config.tree_cuttter_requires_power")
.comment("Defines if the Small Tree Cutter does not work without RF power.") .comment("Defines if the Small Tree Cutter does not work without RF power.")
@ -479,11 +477,11 @@ public class ModConfig
"Note this is a permanent standby power, not only when the device does something. " + "Note this is a permanent standby power, not only when the device does something. " +
"Use zero to disable energy dependency and energy handling of the machine. " + "Use zero to disable energy dependency and energy handling of the machine. " +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("milking_machine_energy_consumption", BlockDecorMilker.BTileEntity.DEFAULT_ENERGY_CONSUMPTION, 0, 1024); .defineInRange("milking_machine_energy_consumption", EdMilker.MilkerTileEntity.DEFAULT_ENERGY_CONSUMPTION, 0, 1024);
milking_machine_milking_delay = builder milking_machine_milking_delay = builder
.translation(ModEngineersDecor.MODID + ".config.milking_machine_milking_delay") .translation(ModEngineersDecor.MODID + ".config.milking_machine_milking_delay")
.comment("Defines (for each individual cow) the minimum time between milking." ) .comment("Defines (for each individual cow) the minimum time between milking." )
.defineInRange("milking_machine_milking_delay", BlockDecorMilker.BTileEntity.DEFAULT_MILKING_DELAY_PER_COW, 1000, 24000); .defineInRange("milking_machine_milking_delay", EdMilker.MilkerTileEntity.DEFAULT_MILKING_DELAY_PER_COW, 1000, 24000);
builder.pop(); builder.pop();
} }
} }
@ -510,8 +508,8 @@ public class ModConfig
// Hard IE dependent blocks // Hard IE dependent blocks
if(!immersiveengineering_installed) { if(!immersiveengineering_installed) {
if(block == ModContent.CONCRETE_WALL) return true; if(block == ModContent.CONCRETE_WALL) return true;
if((block instanceof BlockDecor) && ((((BlockDecor)block).config & BlockDecor.CFG_HARD_IE_DEPENDENT) != 0)) return true; if((block instanceof DecorBlock.Normal) && ((((DecorBlock.Normal)block).config & DecorBlock.CFG_HARD_IE_DEPENDENT) != 0)) return true;
if((block instanceof StandardBlocks.BaseBlock) && ((((StandardBlocks.BaseBlock)block).config & BlockDecor.CFG_HARD_IE_DEPENDENT) != 0)) return true; if((block instanceof StandardBlocks.BaseBlock) && ((((StandardBlocks.BaseBlock)block).config & DecorBlock.CFG_HARD_IE_DEPENDENT) != 0)) return true;
} }
// Force-include/exclude pattern matching // Force-include/exclude pattern matching
try { try {
@ -533,31 +531,31 @@ public class ModConfig
excludes_.clear(); excludes_.clear();
} }
// Early non-opt out type based evaluation // Early non-opt out type based evaluation
if(block instanceof BlockDecorCraftingTable.CraftingTableBlock) return COMMON.without_crafting_table.get(); if(block instanceof EdCraftingTable.CraftingTableBlock) return COMMON.without_crafting_table.get();
if(block instanceof BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock) return COMMON.without_electrical_furnace.get(); if(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock) return COMMON.without_electrical_furnace.get();
if((block instanceof BlockDecorFurnace.DecorFurnaceBlock) && (!(block instanceof BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock))) return COMMON.without_lab_furnace.get(); if((block instanceof EdFurnace.FurnaceBlock) && (!(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock))) return COMMON.without_lab_furnace.get();
if(block instanceof BlockDecorPassiveFluidAccumulator) return COMMON.without_passive_fluid_accumulator.get(); if(block instanceof EdFluidAccumulator.FluidAccumulatorBlock) return COMMON.without_passive_fluid_accumulator.get();
if(block instanceof BlockDecorWasteIncinerator) return COMMON.without_waste_incinerator.get(); if(block instanceof EdWasteIncinerator.WasteIncineratorBlock) return COMMON.without_waste_incinerator.get();
if(block instanceof BlockDecorDropper) return COMMON.without_factory_dropper.get(); if(block instanceof EdDropper.DropperBlock) return COMMON.without_factory_dropper.get();
if(block instanceof BlockDecorPlacer) return COMMON.without_factory_placer.get(); if(block instanceof EdPlacer.PlacerBlock) return COMMON.without_factory_placer.get();
if(block instanceof BlockDecorBreaker) return COMMON.without_block_breaker.get(); if(block instanceof EdBreaker.BreakerBlock) return COMMON.without_block_breaker.get();
if(block instanceof BlockDecorHalfSlab) return COMMON.without_halfslabs.get(); if(block instanceof EdSlabSliceBlock) return COMMON.without_halfslabs.get();
if(block instanceof BlockDecorLadder) return COMMON.without_ladders.get(); if(block instanceof EdLadderBlock) return COMMON.without_ladders.get();
if(block instanceof BlockDecorWindow) return COMMON.without_windows.get(); if(block instanceof EdWindowBlock) return COMMON.without_windows.get();
if(block instanceof BlockDecorPipeValve.DecorPipeValveBlock) return COMMON.without_valves.get(); if(block instanceof EdPipeValve.PipeValveBlock) return COMMON.without_valves.get();
if(block instanceof BlockDecorHorizontalSupport) return COMMON.without_hsupports.get(); if(block instanceof EdHorizontalSupportBlock) return COMMON.without_hsupports.get();
if(block instanceof BlockDecorFloorGrating) return COMMON.without_floor_grating.get(); if(block instanceof EdFloorGratingBlock) return COMMON.without_floor_grating.get();
if(block instanceof BlockDecorHopper.DecorHopperBlock) return COMMON.without_factory_hopper.get(); if(block instanceof EdHopper.HopperBlock) return COMMON.without_factory_hopper.get();
if(block instanceof BlockDecorFluidFunnel) return COMMON.without_fluid_funnel.get(); if(block instanceof EdFluidFunnel.FluidFunnelBlock) return COMMON.without_fluid_funnel.get();
if(block instanceof BlockDecorSolarPanel) return COMMON.without_solar_panel.get(); if(block instanceof EdSolarPanel.SolarPanelBlock) return COMMON.without_solar_panel.get();
if(block instanceof BlockDecorMineralSmelter.DecorMineralSmelterBlock) return COMMON.without_mineral_smelter.get(); if(block instanceof EdMineralSmelter.MineralSmelterBlock) return COMMON.without_mineral_smelter.get();
if(block instanceof BlockDecorMilker) return COMMON.without_milking_machine.get(); if(block instanceof EdMilker.MilkerBlock) return COMMON.without_milking_machine.get();
if(block instanceof BlockDecorTreeCutter) return COMMON.without_tree_cutter.get(); if(block instanceof EdTreeCutter.TreeCutterBlock) return COMMON.without_tree_cutter.get();
// Type based evaluation where later filters may match, too // Type based evaluation where later filters may match, too
if(COMMON.without_slabs.get() && (block instanceof BlockDecorSlab)) return true; if(COMMON.without_slabs.get() && (block instanceof EdSlabBlock)) return true;
if(COMMON.without_stairs.get() && (block instanceof BlockDecorStairs)) return true; if(COMMON.without_stairs.get() && (block instanceof EdStairsBlock)) return true;
if(COMMON.without_walls.get() && (block instanceof BlockDecorWall)) return true; if(COMMON.without_walls.get() && (block instanceof EdWallBlock)) return true;
if(COMMON.without_poles.get() && (block instanceof BlockDecorStraightPole)) return true; if(COMMON.without_poles.get() && (block instanceof EdStraightPoleBlock)) return true;
// String matching based evaluation // String matching based evaluation
if(COMMON.without_clinker_bricks.get() && (rn.startsWith("clinker_brick_"))) return true; if(COMMON.without_clinker_bricks.get() && (rn.startsWith("clinker_brick_"))) return true;
if(COMMON.without_slag_bricks.get() && rn.startsWith("slag_brick_")) return true; if(COMMON.without_slag_bricks.get() && rn.startsWith("slag_brick_")) return true;
@ -567,7 +565,7 @@ public class ModConfig
if(COMMON.without_light_sources.get() && rn.endsWith("_light")) return true; if(COMMON.without_light_sources.get() && rn.endsWith("_light")) return true;
if(COMMON.without_sign_plates.get() && rn.startsWith("sign_")) return true; if(COMMON.without_sign_plates.get() && rn.startsWith("sign_")) return true;
if(COMMON.without_treated_wood_furniture.get()) { if(COMMON.without_treated_wood_furniture.get()) {
if(block instanceof BlockDecorChair) return true; if(block instanceof EdChair.ChairBlock) return true;
if(rn.equals("treated_wood_table")) return true; if(rn.equals("treated_wood_table")) return true;
if(rn.equals("treated_wood_stool")) return true; if(rn.equals("treated_wood_stool")) return true;
if(rn.equals("treated_wood_windowsill")) return true; if(rn.equals("treated_wood_windowsill")) return true;
@ -614,19 +612,19 @@ public class ModConfig
without_recipes_ = COMMON.without_recipes.get(); without_recipes_ = COMMON.without_recipes.get();
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
OptionalRecipeCondition.on_config(with_experimental_features_, without_recipes_, ModConfig::isOptedOut, ModConfig::isOptedOut); OptionalRecipeCondition.on_config(with_experimental_features_, without_recipes_, ModConfig::isOptedOut, ModConfig::isOptedOut);
BlockDecorFurnace.DecorFurnaceTileEntity.on_config(COMMON.furnace_smelting_speed_percent.get(), COMMON.furnace_fuel_efficiency_percent.get(), COMMON.furnace_boost_energy_consumption.get()); EdFurnace.FurnaceTileEntity.on_config(COMMON.furnace_smelting_speed_percent.get(), COMMON.furnace_fuel_efficiency_percent.get(), COMMON.furnace_boost_energy_consumption.get());
BlockDecorChair.on_config(COMMON.without_chair_sitting.get(), COMMON.without_mob_chair_sitting.get(), COMMON.chair_mob_sitting_probability_percent.get(), COMMON.chair_mob_standup_probability_percent.get()); EdChair.on_config(COMMON.without_chair_sitting.get(), COMMON.without_mob_chair_sitting.get(), COMMON.chair_mob_sitting_probability_percent.get(), COMMON.chair_mob_standup_probability_percent.get());
BlockDecorLadder.on_config(COMMON.without_ladder_speed_boost.get()); EdLadderBlock.on_config(COMMON.without_ladder_speed_boost.get());
BlockDecorCraftingTable.on_config(COMMON.without_crafting_table_history.get(), false, COMMON.with_crafting_quickmove_buttons.get(), COMMON.without_crafting_mouse_scrolling.get()); EdCraftingTable.on_config(COMMON.without_crafting_table_history.get(), false, COMMON.with_crafting_quickmove_buttons.get(), COMMON.without_crafting_mouse_scrolling.get());
BlockDecorPipeValve.on_config(COMMON.pipevalve_max_flowrate.get(), COMMON.pipevalve_redstone_gain.get()); EdPipeValve.on_config(COMMON.pipevalve_max_flowrate.get(), COMMON.pipevalve_redstone_gain.get());
BlockDecorFurnaceElectrical.DecorFurnaceElectrical.on_config(COMMON.e_furnace_speed_percent.get(), COMMON.e_furnace_power_consumption.get(), COMMON.e_furnace_automatic_pulling.get()); EdElectricalFurnace.ElectricalFurnaceTileEntity.on_config(COMMON.e_furnace_speed_percent.get(), COMMON.e_furnace_power_consumption.get(), COMMON.e_furnace_automatic_pulling.get());
BlockDecorSolarPanel.BTileEntity.on_config(COMMON.small_solar_panel_peak_production.get()); EdSolarPanel.SolarPanelTileEntity.on_config(COMMON.small_solar_panel_peak_production.get());
BlockDecorBreaker.BTileEntity.on_config(COMMON.block_breaker_power_consumption.get(), COMMON.block_breaker_reluctance.get(), COMMON.block_breaker_min_breaking_time.get(), COMMON.block_breaker_requires_power.get()); EdBreaker.BreakerTileEntity.on_config(COMMON.block_breaker_power_consumption.get(), COMMON.block_breaker_reluctance.get(), COMMON.block_breaker_min_breaking_time.get(), COMMON.block_breaker_requires_power.get());
BlockDecorTreeCutter.BTileEntity.on_config(COMMON.tree_cuttter_energy_consumption.get(), COMMON.tree_cuttter_cutting_time_needed.get(), COMMON.tree_cuttter_requires_power.get()); EdTreeCutter.TreeCutterTileEntity.on_config(COMMON.tree_cuttter_energy_consumption.get(), COMMON.tree_cuttter_cutting_time_needed.get(), COMMON.tree_cuttter_requires_power.get());
BlockDecorMilker.BTileEntity.on_config(COMMON.milking_machine_energy_consumption.get(), COMMON.milking_machine_milking_delay.get()); EdMilker.MilkerTileEntity.on_config(COMMON.milking_machine_energy_consumption.get(), COMMON.milking_machine_milking_delay.get());
BlockDecorSlab.on_config(!COMMON.without_direct_slab_pickup.get()); EdSlabBlock.on_config(!COMMON.without_direct_slab_pickup.get());
BlockDecorHalfSlab.on_config(!COMMON.without_direct_slab_pickup.get()); EdSlabSliceBlock.on_config(!COMMON.without_direct_slab_pickup.get());
BlockDecorLabeledCrate.on_config(false); EdLabeledCrate.on_config(false);
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
if(with_experimental_features_) { if(with_experimental_features_) {
ModEngineersDecor.logger().info("Config: EXPERIMENTAL FEATURES ENABLED."); ModEngineersDecor.logger().info("Config: EXPERIMENTAL FEATURES ENABLED.");

View file

@ -15,6 +15,7 @@ package wile.engineersdecor;
import wile.engineersdecor.blocks.*; import wile.engineersdecor.blocks.*;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import wile.engineersdecor.libmc.blocks.StandardBlocks;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
@ -51,181 +52,181 @@ public class ModContent
// Blocks // Blocks
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static final BlockDecor CLINKER_BRICK_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal CLINKER_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_block"));
public static final BlockDecorSlab CLINKER_BRICK_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock CLINKER_BRICK_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_slab"));
public static final BlockDecorStairs CLINKER_BRICK_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock CLINKER_BRICK_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
CLINKER_BRICK_BLOCK.getDefaultState(), CLINKER_BRICK_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stairs"));
public static final BlockDecorWall CLINKER_BRICK_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock CLINKER_BRICK_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_wall"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor CLINKER_BRICK_STAINED_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal CLINKER_BRICK_STAINED_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_block"));
public static final BlockDecorSlab CLINKER_BRICK_STAINED_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock CLINKER_BRICK_STAINED_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_slab"));
public static final BlockDecorStairs CLINKER_BRICK_STAINED_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock CLINKER_BRICK_STAINED_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
CLINKER_BRICK_BLOCK.getDefaultState(), CLINKER_BRICK_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_stairs"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor SLAG_BRICK_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal SLAG_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_block"));
public static final BlockDecorSlab SLAG_BRICK_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock SLAG_BRICK_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_slab"));
public static final BlockDecorStairs SLAG_BRICK_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock SLAG_BRICK_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
SLAG_BRICK_BLOCK.getDefaultState(), SLAG_BRICK_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_stairs"));
public static final BlockDecorWall SLAG_BRICK_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock SLAG_BRICK_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_wall"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor REBAR_CONCRETE_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal REBAR_CONCRETE_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete"));
public static final BlockDecorSlab REBAR_CONCRETE_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock REBAR_CONCRETE_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_slab"));
public static final BlockDecorStairs REBAR_CONCRETE_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock REBAR_CONCRETE_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
REBAR_CONCRETE_BLOCK.getDefaultState(), REBAR_CONCRETE_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_stairs"));
public static final BlockDecorWall REBAR_CONCRETE_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock REBAR_CONCRETE_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_wall"));
public static final BlockDecorHalfSlab HALFSLAB_REBARCONCRETE = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_REBARCONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_rebar_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_rebar_concrete"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor GAS_CONCRETE_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal GAS_CONCRETE_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete"));
public static final BlockDecorSlab GAS_CONCRETE_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock GAS_CONCRETE_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_slab"));
public static final BlockDecorStairs GAS_CONCRETE_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock GAS_CONCRETE_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
REBAR_CONCRETE_BLOCK.getDefaultState(), REBAR_CONCRETE_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_stairs"));
public static final BlockDecorWall GAS_CONCRETE_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock GAS_CONCRETE_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_wall"));
public static final BlockDecorHalfSlab HALFSLAB_GASCONCRETE = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_GASCONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_gas_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_gas_concrete"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor REBAR_CONCRETE_TILE = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal REBAR_CONCRETE_TILE = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile"));
public static final BlockDecorSlab REBAR_CONCRETE_TILE_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock REBAR_CONCRETE_TILE_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile_slab"));
public static final BlockDecorStairs REBAR_CONCRETE_TILE_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock REBAR_CONCRETE_TILE_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
REBAR_CONCRETE_TILE.getDefaultState(), REBAR_CONCRETE_TILE.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile_stairs"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorGlassBlock PANZERGLASS_BLOCK = (BlockDecorGlassBlock)(new BlockDecorGlassBlock( public static final EdGlassBlock PANZERGLASS_BLOCK = (EdGlassBlock)(new EdGlassBlock(
BlockDecor.CFG_TRANSLUCENT, DecorBlock.CFG_TRANSLUCENT,
Block.Properties.create(Material.GLASS, MaterialColor.AIR).hardnessAndResistance(5f, 2000f).sound(SoundType.METAL) Block.Properties.create(Material.GLASS, MaterialColor.AIR).hardnessAndResistance(5f, 2000f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "panzerglass_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "panzerglass_block"));
public static final BlockDecorSlab PANZERGLASS_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock PANZERGLASS_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_TRANSLUCENT, DecorBlock.CFG_TRANSLUCENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5f, 2000f).sound(SoundType.METAL) Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5f, 2000f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "panzerglass_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "panzerglass_slab"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorLadder METAL_RUNG_LADDER = (BlockDecorLadder)(new BlockDecorLadder( public static final EdLadderBlock METAL_RUNG_LADDER = (EdLadderBlock)(new EdLadderBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 25f).sound(SoundType.METAL) Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 25f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_rung_ladder")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_rung_ladder"));
public static final BlockDecorLadder METAL_RUNG_STEPS = (BlockDecorLadder)(new BlockDecorLadder( public static final EdLadderBlock METAL_RUNG_STEPS = (EdLadderBlock)(new EdLadderBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 25f).sound(SoundType.METAL) Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 25f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_rung_steps")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_rung_steps"));
public static final BlockDecorLadder TREATED_WOOD_LADDER = (BlockDecorLadder)(new BlockDecorLadder( public static final EdLadderBlock TREATED_WOOD_LADDER = (EdLadderBlock)(new EdLadderBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.0f, 25f).sound(SoundType.WOOD) Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.0f, 25f).sound(SoundType.WOOD)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_ladder")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_ladder"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor.WaterLoggable TREATED_WOOD_TABLE = (BlockDecor.WaterLoggable)(new BlockDecor.WaterLoggable( public static final DecorBlock.WaterLoggable TREATED_WOOD_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(1,0,1, 15,15.9,15) Auxiliaries.getPixeledAABB(1,0,1, 15,15.9,15)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_table")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_table"));
public static final BlockDecorChair TREATED_WOOD_STOOL = (BlockDecorChair)(new BlockDecorChair( public static final EdChair.ChairBlock TREATED_WOOD_STOOL = (EdChair.ChairBlock)(new EdChair.ChairBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(4,7,4, 12,8.8,12), Auxiliaries.getPixeledAABB(4,7,4, 12,8.8,12),
@ -235,154 +236,154 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_stool")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_stool"));
public static final BlockDecor.WaterLoggable TREATED_WOOD_SIDE_TABLE = (BlockDecor.WaterLoggable)(new BlockDecor.WaterLoggable( public static final DecorBlock.WaterLoggable TREATED_WOOD_SIDE_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(2,0,2, 14,15.9,14) Auxiliaries.getPixeledAABB(2,0,2, 14,15.9,14)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_side_table")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_side_table"));
public static final BlockDecor.DirectedWaterLoggable TREATED_WOOD_WINDOWSILL = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable TREATED_WOOD_WINDOWSILL = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(0.5,15,10.5, 15.5,16,16) Auxiliaries.getPixeledAABB(0.5,15,10.5, 15.5,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_windowsill")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_windowsill"));
public static final BlockDecor.DirectedWaterLoggable TREATED_WOOD_BROAD_WINDOWSILL = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable TREATED_WOOD_BROAD_WINDOWSILL = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(0,14.5,4, 16,16,16) Auxiliaries.getPixeledAABB(0,14.5,4, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_broad_windowsill")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_broad_windowsill"));
public static final BlockDecor.DirectedWaterLoggable INSET_LIGHT_IRON = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable INSET_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).lightValue(15), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).lightValue(15),
Auxiliaries.getPixeledAABB(5.2,5.2,0, 10.8,10.8,0.3) Auxiliaries.getPixeledAABB(5.2,5.2,0, 10.8,10.8,0.3)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "iron_inset_light")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "iron_inset_light"));
public static final BlockDecor.DirectedWaterLoggable FLOOR_EDGE_LIGHT_IRON = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable FLOOR_EDGE_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).lightValue(15), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).lightValue(15),
Auxiliaries.getPixeledAABB(5,0,0, 11,2,0.5) Auxiliaries.getPixeledAABB(5,0,0, 11,2,0.5)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "iron_floor_edge_light")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "iron_floor_edge_light"));
public static final BlockDecor.WaterLoggable STEEL_TABLE = (BlockDecor.WaterLoggable)(new BlockDecor.WaterLoggable( public static final DecorBlock.WaterLoggable STEEL_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_table")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_table"));
public static final BlockDecorFloorGrating STEEL_FLOOR_GRATING = (BlockDecorFloorGrating)(new BlockDecorFloorGrating( public static final EdFloorGratingBlock STEEL_FLOOR_GRATING = (EdFloorGratingBlock)(new EdFloorGratingBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,14,0, 16,15.9,16) Auxiliaries.getPixeledAABB(0,14,0, 16,15.9,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_floor_grating")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_floor_grating"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorWindow TREATED_WOOD_WINDOW = (BlockDecorWindow)(new BlockDecorWindow( public static final EdWindowBlock TREATED_WOOD_WINDOW = (EdWindowBlock)(new EdWindowBlock(
BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS),
Auxiliaries.getPixeledAABB(0,0,7, 16,16,9) Auxiliaries.getPixeledAABB(0,0,7, 16,16,9)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_window")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_window"));
public static final BlockDecorWindow STEEL_FRAMED_WINDOW = (BlockDecorWindow)(new BlockDecorWindow( public static final EdWindowBlock STEEL_FRAMED_WINDOW = (EdWindowBlock)(new EdWindowBlock(
BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS),
Auxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5) Auxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_framed_window")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_framed_window"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorStraightPole TREATED_WOOD_POLE = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock TREATED_WOOD_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole"));
public static final BlockDecorStraightPole TREATED_WOOD_POLE_HEAD = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock TREATED_WOOD_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole_head")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole_head"));
public static final BlockDecorStraightPole TREATED_WOOD_POLE_SUPPORT = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock TREATED_WOOD_POLE_SUPPORT = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole_support")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole_support"));
public static final BlockDecorStraightPole THIN_STEEL_POLE = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock THIN_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(6,6,0, 10,10,16) Auxiliaries.getPixeledAABB(6,6,0, 10,10,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thin_steel_pole")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thin_steel_pole"));
public static final BlockDecorStraightPole THIN_STEEL_POLE_HEAD = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock THIN_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(6,6,0, 10,10,16) Auxiliaries.getPixeledAABB(6,6,0, 10,10,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thin_steel_pole_head")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thin_steel_pole_head"));
public static final BlockDecorStraightPole THICK_STEEL_POLE = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock THICK_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(5,5,0, 11,11,16) Auxiliaries.getPixeledAABB(5,5,0, 11,11,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thick_steel_pole")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thick_steel_pole"));
public static final BlockDecorStraightPole THICK_STEEL_POLE_HEAD = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock THICK_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(5,5,0, 11,11,16) Auxiliaries.getPixeledAABB(5,5,0, 11,11,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thick_steel_pole_head")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thick_steel_pole_head"));
public static final BlockDecorHorizontalSupport STEEL_DOUBLE_T_SUPPORT = (BlockDecorHorizontalSupport)(new BlockDecorHorizontalSupport( public static final EdHorizontalSupportBlock STEEL_DOUBLE_T_SUPPORT = (EdHorizontalSupportBlock)(new EdHorizontalSupportBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(5,11,0, 11,16,16) Auxiliaries.getPixeledAABB(5,11,0, 11,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_double_t_support")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_double_t_support"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor.DirectedWaterLoggable SIGN_MODLOGO = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_MODLOGO = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1000f).sound(SoundType.WOOD).lightValue(1), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1000f).sound(SoundType.WOOD).lightValue(1),
Auxiliaries.getPixeledAABB(0,0,15.6, 16,16,16.0) Auxiliaries.getPixeledAABB(0,0,15.6, 16,16,16.0)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_decor")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_decor"));
public static final BlockDecor.DirectedWaterLoggable SIGN_HOTWIRE = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_HOTWIRE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_hotwire")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_hotwire"));
public static final BlockDecor.DirectedWaterLoggable SIGN_DANGER = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_DANGER = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_danger")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_danger"));
public static final BlockDecor.DirectedWaterLoggable SIGN_DEFENSE = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_DEFENSE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_defense")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_defense"));
public static final BlockDecor.DirectedWaterLoggable SIGN_FACTORY_AREA = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_FACTORY_AREA = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_factoryarea")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_factoryarea"));
public static final BlockDecor.DirectedWaterLoggable SIGN_EXIT = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_EXIT = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD),
Auxiliaries.getPixeledAABB(3,7,15.6, 13,13,16) Auxiliaries.getPixeledAABB(3,7,15.6, 13,13,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_exit")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_exit"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorCraftingTable.CraftingTableBlock TREATED_WOOD_CRAFTING_TABLE = (BlockDecorCraftingTable.CraftingTableBlock)(new BlockDecorCraftingTable.CraftingTableBlock( public static final EdCraftingTable.CraftingTableBlock TREATED_WOOD_CRAFTING_TABLE = (EdCraftingTable.CraftingTableBlock)(new EdCraftingTable.CraftingTableBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 15f).sound(SoundType.WOOD), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 15f).sound(SoundType.WOOD),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0,13,0, 16,16,16), Auxiliaries.getPixeledAABB(0,13,0, 16,16,16),
@ -390,8 +391,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_crafting_table")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_crafting_table"));
public static final BlockDecorFurnace.DecorFurnaceBlock SMALL_LAB_FURNACE = (BlockDecorFurnace.DecorFurnaceBlock)(new BlockDecorFurnace.DecorFurnaceBlock( public static final EdFurnace.FurnaceBlock SMALL_LAB_FURNACE = (EdFurnace.FurnaceBlock)(new EdFurnace.FurnaceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(1,0,1, 15, 1,15), Auxiliaries.getPixeledAABB(1,0,1, 15, 1,15),
@ -399,8 +400,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_lab_furnace")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_lab_furnace"));
public static final BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock SMALL_ELECTRICAL_FURNACE = (BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock)(new BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock( public static final EdElectricalFurnace.ElectricalFurnaceBlock SMALL_ELECTRICAL_FURNACE = (EdElectricalFurnace.ElectricalFurnaceBlock)(new EdElectricalFurnace.ElectricalFurnaceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0, 0,0, 16,11,16), Auxiliaries.getPixeledAABB(0, 0,0, 16,11,16),
@ -411,14 +412,14 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_electrical_furnace")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_electrical_furnace"));
public static final BlockDecorDropper FACTORY_DROPPER = (BlockDecorDropper)(new BlockDecorDropper( public static final EdDropper.DropperBlock FACTORY_DROPPER = (EdDropper.DropperBlock)(new EdDropper.DropperBlock(
BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,0,1, 16,16,16) Auxiliaries.getPixeledAABB(0,0,1, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_dropper")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_dropper"));
public static final BlockDecorPlacer FACTORY_PLACER = (BlockDecorPlacer)(new BlockDecorPlacer( public static final EdPlacer.PlacerBlock FACTORY_PLACER = (EdPlacer.PlacerBlock)(new EdPlacer.PlacerBlock(
BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0,0,2, 16,16,16), Auxiliaries.getPixeledAABB(0,0,2, 16,16,16),
@ -427,8 +428,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_placer")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_placer"));
public static final BlockDecorBreaker SMALL_BLOCK_BREAKER = (BlockDecorBreaker)(new BlockDecorBreaker( public static final EdBreaker.BreakerBlock SMALL_BLOCK_BREAKER = (EdBreaker.BreakerBlock)(new EdBreaker.BreakerBlock(
BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK, DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(1,0,0, 15, 4, 7), Auxiliaries.getPixeledAABB(1,0,0, 15, 4, 7),
@ -440,8 +441,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_block_breaker")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_block_breaker"));
public static final BlockDecorHopper.DecorHopperBlock FACTORY_HOPPER = (BlockDecorHopper.DecorHopperBlock)(new BlockDecorHopper.DecorHopperBlock( public static final EdHopper.HopperBlock FACTORY_HOPPER = (EdHopper.HopperBlock)(new EdHopper.HopperBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), ()->{ Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), ()->{
final AxisAlignedBB[] down_aabbs = new AxisAlignedBB[]{ final AxisAlignedBB[] down_aabbs = new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 5, 0, 5, 11, 1,11), Auxiliaries.getPixeledAABB( 5, 0, 5, 11, 1,11),
@ -486,20 +487,20 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_hopper")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_hopper"));
public static final BlockDecorWasteIncinerator SMALL_WASTE_INCINERATOR = (BlockDecorWasteIncinerator)(new BlockDecorWasteIncinerator( public static final EdWasteIncinerator.WasteIncineratorBlock SMALL_WASTE_INCINERATOR = (EdWasteIncinerator.WasteIncineratorBlock)(new EdWasteIncinerator.WasteIncineratorBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_waste_incinerator")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_waste_incinerator"));
public static final BlockDecorMineralSmelter.DecorMineralSmelterBlock SMALL_MINERAL_SMELTER = (BlockDecorMineralSmelter.DecorMineralSmelterBlock)(new BlockDecorMineralSmelter.DecorMineralSmelterBlock( public static final EdMineralSmelter.MineralSmelterBlock SMALL_MINERAL_SMELTER = (EdMineralSmelter.MineralSmelterBlock)(new EdMineralSmelter.MineralSmelterBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(1.1,0,1.1, 14.9,16,14.9) Auxiliaries.getPixeledAABB(1.1,0,1.1, 14.9,16,14.9)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_mineral_smelter")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_mineral_smelter"));
public static final BlockDecorSolarPanel SMALL_SOLAR_PANEL = (BlockDecorSolarPanel)(new BlockDecorSolarPanel( public static final EdSolarPanel.SolarPanelBlock SMALL_SOLAR_PANEL = (EdSolarPanel.SolarPanelBlock)(new EdSolarPanel.SolarPanelBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0,0,0, 16,2,16), Auxiliaries.getPixeledAABB(0,0,0, 16,2,16),
@ -507,8 +508,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_solar_panel")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_solar_panel"));
public static final BlockDecorMilker SMALL_MILKING_MACHINE = (BlockDecorMilker)(new BlockDecorMilker( public static final EdMilker.MilkerBlock SMALL_MILKING_MACHINE = (EdMilker.MilkerBlock)(new EdMilker.MilkerBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 1, 1,0, 15,14,10), Auxiliaries.getPixeledAABB( 1, 1,0, 15,14,10),
@ -519,8 +520,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_milking_machine")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_milking_machine"));
public static final BlockDecorTreeCutter SMALL_TREE_CUTTER = (BlockDecorTreeCutter)(new BlockDecorTreeCutter( public static final EdTreeCutter.TreeCutterBlock SMALL_TREE_CUTTER = (EdTreeCutter.TreeCutterBlock)(new EdTreeCutter.TreeCutterBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 0,0, 0, 16,3,16), Auxiliaries.getPixeledAABB( 0,0, 0, 16,3,16),
@ -532,9 +533,9 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_tree_cutter")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_tree_cutter"));
public static final BlockDecorPipeValve.DecorPipeValveBlock STRAIGHT_CHECK_VALVE = (BlockDecorPipeValve.DecorPipeValveBlock)(new BlockDecorPipeValve.DecorPipeValveBlock( public static final EdPipeValve.PipeValveBlock STRAIGHT_CHECK_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
BlockDecorPipeValve.CFG_CHECK_VALVE, EdPipeValve.CFG_CHECK_VALVE,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2),
@ -544,9 +545,9 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve"));
public static final BlockDecorPipeValve.DecorPipeValveBlock STRAIGHT_REDSTONE_VALVE = (BlockDecorPipeValve.DecorPipeValveBlock)(new BlockDecorPipeValve.DecorPipeValveBlock( public static final EdPipeValve.PipeValveBlock STRAIGHT_REDSTONE_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
BlockDecorPipeValve.CFG_REDSTONE_CONTROLLED_VALVE, EdPipeValve.CFG_REDSTONE_CONTROLLED_VALVE,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2),
@ -556,9 +557,9 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone"));
public static final BlockDecorPipeValve.DecorPipeValveBlock STRAIGHT_REDSTONE_ANALOG_VALVE = (BlockDecorPipeValve.DecorPipeValveBlock)(new BlockDecorPipeValve.DecorPipeValveBlock( public static final EdPipeValve.PipeValveBlock STRAIGHT_REDSTONE_ANALOG_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
BlockDecorPipeValve.CFG_REDSTONE_CONTROLLED_VALVE|BlockDecorPipeValve.CFG_ANALOG_VALVE, EdPipeValve.CFG_REDSTONE_CONTROLLED_VALVE|EdPipeValve.CFG_ANALOG_VALVE,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2),
@ -568,8 +569,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone_analog")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone_analog"));
public static final BlockDecorPassiveFluidAccumulator PASSIVE_FLUID_ACCUMULATOR = (BlockDecorPassiveFluidAccumulator)(new BlockDecorPassiveFluidAccumulator( public static final EdFluidAccumulator.FluidAccumulatorBlock PASSIVE_FLUID_ACCUMULATOR = (EdFluidAccumulator.FluidAccumulatorBlock)(new EdFluidAccumulator.FluidAccumulatorBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(3,3,0, 13,13, 1), Auxiliaries.getPixeledAABB(3,3,0, 13,13, 1),
@ -577,8 +578,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "passive_fluid_accumulator")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "passive_fluid_accumulator"));
public static final BlockDecorFluidFunnel SMALL_FLUID_FUNNEL = (BlockDecorFluidFunnel)(new BlockDecorFluidFunnel( public static final EdFluidFunnel.FluidFunnelBlock SMALL_FLUID_FUNNEL = (EdFluidFunnel.FluidFunnelBlock)(new EdFluidFunnel.FluidFunnelBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0, 0,0, 16,14,16), Auxiliaries.getPixeledAABB(0, 0,0, 16,14,16),
@ -587,72 +588,72 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_fluid_funnel")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_fluid_funnel"));
public static final BlockDecorLabeledCrate.DecorLabeledCrateBlock LABELED_CRATE = (BlockDecorLabeledCrate.DecorLabeledCrateBlock)(new BlockDecorLabeledCrate.DecorLabeledCrateBlock( public static final EdLabeledCrate.LabeledCrateBlock LABELED_CRATE = (EdLabeledCrate.LabeledCrateBlock)(new EdLabeledCrate.LabeledCrateBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(0.5f, 128f).sound(SoundType.METAL), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(0.5f, 128f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "labeled_crate")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "labeled_crate"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorWall CONCRETE_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock CONCRETE_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "concrete_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "concrete_wall"));
public static final BlockDecorHalfSlab HALFSLAB_CONCRETE = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_CONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_concrete"));
public static final BlockDecorHalfSlab HALFSLAB_TREATEDWOOD = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_TREATEDWOOD = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 4f).sound(SoundType.WOOD) Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 4f).sound(SoundType.WOOD)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_treated_wood")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_treated_wood"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALIRON = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALIRON = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL) Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_iron")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_iron"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALSTEEL = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALSTEEL = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL) Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_steel")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_steel"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALCOPPER = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALCOPPER = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL) Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_copper")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_copper"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALGOLD = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALGOLD = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL) Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_gold")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_gold"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALALUMINIUM = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALALUMINIUM = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL) Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_aluminum")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_aluminum"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorFence STEEL_MESH_FENCE = (BlockDecorFence)(new BlockDecorFence( public static final EdFenceBlock STEEL_MESH_FENCE = (EdFenceBlock)(new EdFenceBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
1.5, 16, 0.25, 0, 16 1.5, 16, 0.25, 0, 16
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_mesh_fence")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_mesh_fence"));
public static final BlockDecorDoubleGate STEEL_MESH_FENCE_GATE = (BlockDecorDoubleGate)(new BlockDecorDoubleGate( public static final EdDoubleGateBlock STEEL_MESH_FENCE_GATE = (EdDoubleGateBlock)(new EdDoubleGateBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,0,6.5, 16,16,9.5) Auxiliaries.getPixeledAABB(0,0,6.5, 16,16,9.5)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_mesh_fence_gate")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_mesh_fence_gate"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorTest TEST_BLOCK = (BlockDecorTest)(new BlockDecorTest( public static final EdTestBlock TEST_BLOCK = (EdTestBlock)(new EdTestBlock(
BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK, DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(0f, 32000f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(0f, 32000f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "test_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "test_block"));
@ -753,87 +754,87 @@ public class ModContent
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static final TileEntityType<?> TET_TREATED_WOOD_CRAFTING_TABLE = TileEntityType.Builder public static final TileEntityType<?> TET_TREATED_WOOD_CRAFTING_TABLE = TileEntityType.Builder
.create(BlockDecorCraftingTable.CraftingTableTileEntity::new, TREATED_WOOD_CRAFTING_TABLE) .create(EdCraftingTable.CraftingTableTileEntity::new, TREATED_WOOD_CRAFTING_TABLE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_treated_wood_crafting_table"); .setRegistryName(ModEngineersDecor.MODID, "te_treated_wood_crafting_table");
public static final TileEntityType<?> TET_LABELED_CRATE = TileEntityType.Builder public static final TileEntityType<?> TET_LABELED_CRATE = TileEntityType.Builder
.create(BlockDecorLabeledCrate.LabeledCrateTileEntity::new, LABELED_CRATE) .create(EdLabeledCrate.LabeledCrateTileEntity::new, LABELED_CRATE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_labeled_crate"); .setRegistryName(ModEngineersDecor.MODID, "te_labeled_crate");
public static final TileEntityType<?> TET_SMALL_LAB_FURNACE = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_LAB_FURNACE = TileEntityType.Builder
.create(BlockDecorFurnace.DecorFurnaceTileEntity::new, SMALL_LAB_FURNACE) .create(EdFurnace.FurnaceTileEntity::new, SMALL_LAB_FURNACE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_lab_furnace"); .setRegistryName(ModEngineersDecor.MODID, "te_small_lab_furnace");
public static final TileEntityType<?> TET_SMALL_ELECTRICAL_FURNACE = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_ELECTRICAL_FURNACE = TileEntityType.Builder
.create(BlockDecorFurnaceElectrical.DecorFurnaceElectrical::new, SMALL_ELECTRICAL_FURNACE) .create(EdElectricalFurnace.ElectricalFurnaceTileEntity::new, SMALL_ELECTRICAL_FURNACE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_electrical_furnace"); .setRegistryName(ModEngineersDecor.MODID, "te_small_electrical_furnace");
public static final TileEntityType<?> TET_FACTORY_DROPPER = TileEntityType.Builder public static final TileEntityType<?> TET_FACTORY_DROPPER = TileEntityType.Builder
.create(BlockDecorDropper.BTileEntity::new, FACTORY_DROPPER) .create(EdDropper.DropperTileEntity::new, FACTORY_DROPPER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_factory_dropper"); .setRegistryName(ModEngineersDecor.MODID, "te_factory_dropper");
public static final TileEntityType<?> TET_FACTORY_PLACER = TileEntityType.Builder public static final TileEntityType<?> TET_FACTORY_PLACER = TileEntityType.Builder
.create(BlockDecorPlacer.BTileEntity::new, FACTORY_PLACER) .create(EdPlacer.PlacerTileEntity::new, FACTORY_PLACER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_factory_placer"); .setRegistryName(ModEngineersDecor.MODID, "te_factory_placer");
public static final TileEntityType<?> TET_SMALL_BLOCK_BREAKER = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_BLOCK_BREAKER = TileEntityType.Builder
.create(BlockDecorBreaker.BTileEntity::new, SMALL_BLOCK_BREAKER) .create(EdBreaker.BreakerTileEntity::new, SMALL_BLOCK_BREAKER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_block_breaker"); .setRegistryName(ModEngineersDecor.MODID, "te_small_block_breaker");
public static final TileEntityType<?> TET_FACTORY_HOPPER = TileEntityType.Builder public static final TileEntityType<?> TET_FACTORY_HOPPER = TileEntityType.Builder
.create(BlockDecorHopper.DecorHopperTileEntity::new, FACTORY_HOPPER) .create(EdHopper.HopperTileEntity::new, FACTORY_HOPPER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_factory_hopper"); .setRegistryName(ModEngineersDecor.MODID, "te_factory_hopper");
public static final TileEntityType<?> TET_WASTE_INCINERATOR = TileEntityType.Builder public static final TileEntityType<?> TET_WASTE_INCINERATOR = TileEntityType.Builder
.create(BlockDecorWasteIncinerator.BTileEntity::new, SMALL_WASTE_INCINERATOR) .create(EdWasteIncinerator.WasteIncineratorTileEntity::new, SMALL_WASTE_INCINERATOR)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_waste_incinerator"); .setRegistryName(ModEngineersDecor.MODID, "te_small_waste_incinerator");
public static final TileEntityType<?> TET_STRAIGHT_PIPE_VALVE = TileEntityType.Builder public static final TileEntityType<?> TET_STRAIGHT_PIPE_VALVE = TileEntityType.Builder
.create(BlockDecorPipeValve.DecorPipeValveTileEntity::new, STRAIGHT_CHECK_VALVE, STRAIGHT_REDSTONE_VALVE, STRAIGHT_REDSTONE_ANALOG_VALVE) .create(EdPipeValve.PipeValveTileEntity::new, STRAIGHT_CHECK_VALVE, STRAIGHT_REDSTONE_VALVE, STRAIGHT_REDSTONE_ANALOG_VALVE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_pipe_valve"); .setRegistryName(ModEngineersDecor.MODID, "te_pipe_valve");
public static final TileEntityType<?> TET_PASSIVE_FLUID_ACCUMULATOR = TileEntityType.Builder public static final TileEntityType<?> TET_PASSIVE_FLUID_ACCUMULATOR = TileEntityType.Builder
.create(BlockDecorPassiveFluidAccumulator.BTileEntity::new, PASSIVE_FLUID_ACCUMULATOR) .create(EdFluidAccumulator.FluidAccumulatorTileEntity::new, PASSIVE_FLUID_ACCUMULATOR)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_passive_fluid_accumulator"); .setRegistryName(ModEngineersDecor.MODID, "te_passive_fluid_accumulator");
public static final TileEntityType<?> TET_SMALL_FLUID_FUNNEL = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_FLUID_FUNNEL = TileEntityType.Builder
.create(BlockDecorFluidFunnel.BTileEntity::new, SMALL_FLUID_FUNNEL) .create(EdFluidFunnel.FluidFunnelTileEntity::new, SMALL_FLUID_FUNNEL)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_fluid_funnel"); .setRegistryName(ModEngineersDecor.MODID, "te_small_fluid_funnel");
public static final TileEntityType<?> TET_MINERAL_SMELTER = TileEntityType.Builder public static final TileEntityType<?> TET_MINERAL_SMELTER = TileEntityType.Builder
.create(BlockDecorMineralSmelter.DecorMineralSmelterTileEntity::new, SMALL_MINERAL_SMELTER) .create(EdMineralSmelter.MineralSmelterTileEntity::new, SMALL_MINERAL_SMELTER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_mineral_smelter"); .setRegistryName(ModEngineersDecor.MODID, "te_small_mineral_smelter");
public static final TileEntityType<?> TET_SMALL_SOLAR_PANEL = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_SOLAR_PANEL = TileEntityType.Builder
.create(BlockDecorSolarPanel.BTileEntity::new, SMALL_SOLAR_PANEL) .create(EdSolarPanel.SolarPanelTileEntity::new, SMALL_SOLAR_PANEL)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_solar_panel"); .setRegistryName(ModEngineersDecor.MODID, "te_small_solar_panel");
public static final TileEntityType<?> TET_SMALL_MILKING_MACHINE = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_MILKING_MACHINE = TileEntityType.Builder
.create(BlockDecorMilker.BTileEntity::new, SMALL_MILKING_MACHINE) .create(EdMilker.MilkerTileEntity::new, SMALL_MILKING_MACHINE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_milking_machine"); .setRegistryName(ModEngineersDecor.MODID, "te_small_milking_machine");
public static final TileEntityType<?> TET_SMALL_TREE_CUTTER = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_TREE_CUTTER = TileEntityType.Builder
.create(BlockDecorTreeCutter.BTileEntity::new, SMALL_TREE_CUTTER) .create(EdTreeCutter.TreeCutterTileEntity::new, SMALL_TREE_CUTTER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_tree_cutter"); .setRegistryName(ModEngineersDecor.MODID, "te_small_tree_cutter");
public static final TileEntityType<?> TET_TEST_BLOCK = TileEntityType.Builder public static final TileEntityType<?> TET_TEST_BLOCK = TileEntityType.Builder
.create(BlockDecorPipeValve.DecorPipeValveTileEntity::new, TEST_BLOCK) .create(EdTestBlock.TestTileEntity::new, TEST_BLOCK)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_test_block"); .setRegistryName(ModEngineersDecor.MODID, "te_test_block");
@ -862,10 +863,10 @@ public class ModContent
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static final EntityType<? extends Entity> ET_CHAIR = EntityType.Builder public static final EntityType<? extends Entity> ET_CHAIR = EntityType.Builder
.create(BlockDecorChair.EntityChair::new, EntityClassification.MISC) .create(EdChair.ChairEntity::new, EntityClassification.MISC)
.immuneToFire().size(1e-3f, 1e-3f).disableSerialization() .immuneToFire().size(1e-3f, 1e-3f).disableSerialization()
.setShouldReceiveVelocityUpdates(false).setUpdateInterval(4) .setShouldReceiveVelocityUpdates(false).setUpdateInterval(4)
.setCustomClientFactory(BlockDecorChair.EntityChair::customClientFactory) .setCustomClientFactory(EdChair.ChairEntity::customClientFactory)
.build(new ResourceLocation(ModEngineersDecor.MODID, "et_chair").toString()) .build(new ResourceLocation(ModEngineersDecor.MODID, "et_chair").toString())
.setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "et_chair")) .setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "et_chair"))
; ;
@ -878,31 +879,31 @@ public class ModContent
// Container registration // Container registration
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static final ContainerType<BlockDecorCraftingTable.CraftingTableContainer> CT_TREATED_WOOD_CRAFTING_TABLE; public static final ContainerType<EdCraftingTable.CraftingTableContainer> CT_TREATED_WOOD_CRAFTING_TABLE;
public static final ContainerType<BlockDecorDropper.BContainer> CT_FACTORY_DROPPER; public static final ContainerType<EdDropper.DropperContainer> CT_FACTORY_DROPPER;
public static final ContainerType<BlockDecorPlacer.BContainer> CT_FACTORY_PLACER; public static final ContainerType<EdPlacer.PlacerContainer> CT_FACTORY_PLACER;
public static final ContainerType<BlockDecorHopper.DecorHopperContainer> CT_FACTORY_HOPPER; public static final ContainerType<EdHopper.HopperContainer> CT_FACTORY_HOPPER;
public static final ContainerType<BlockDecorFurnace.DecorFurnaceContainer> CT_SMALL_LAB_FURNACE; public static final ContainerType<EdFurnace.FurnaceContainer> CT_SMALL_LAB_FURNACE;
public static final ContainerType<BlockDecorFurnaceElectrical.DecorFurnaceElectricalContainer> CT_SMALL_ELECTRICAL_FURNACE; public static final ContainerType<EdElectricalFurnace.ElectricalFurnaceContainer> CT_SMALL_ELECTRICAL_FURNACE;
public static final ContainerType<BlockDecorWasteIncinerator.BContainer> CT_WASTE_INCINERATOR; public static final ContainerType<EdWasteIncinerator.WasteIncineratorContainer> CT_WASTE_INCINERATOR;
public static final ContainerType<BlockDecorLabeledCrate.LabeledCrateContainer> CT_LABELED_CRATE; public static final ContainerType<EdLabeledCrate.LabeledCrateContainer> CT_LABELED_CRATE;
static { static {
CT_TREATED_WOOD_CRAFTING_TABLE = (new ContainerType<BlockDecorCraftingTable.CraftingTableContainer>(BlockDecorCraftingTable.CraftingTableContainer::new)); CT_TREATED_WOOD_CRAFTING_TABLE = (new ContainerType<EdCraftingTable.CraftingTableContainer>(EdCraftingTable.CraftingTableContainer::new));
CT_TREATED_WOOD_CRAFTING_TABLE.setRegistryName(ModEngineersDecor.MODID,"ct_treated_wood_crafting_table"); CT_TREATED_WOOD_CRAFTING_TABLE.setRegistryName(ModEngineersDecor.MODID,"ct_treated_wood_crafting_table");
CT_FACTORY_DROPPER = (new ContainerType<BlockDecorDropper.BContainer>(BlockDecorDropper.BContainer::new)); CT_FACTORY_DROPPER = (new ContainerType<EdDropper.DropperContainer>(EdDropper.DropperContainer::new));
CT_FACTORY_DROPPER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_dropper"); CT_FACTORY_DROPPER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_dropper");
CT_FACTORY_PLACER = (new ContainerType<BlockDecorPlacer.BContainer>(BlockDecorPlacer.BContainer::new)); CT_FACTORY_PLACER = (new ContainerType<EdPlacer.PlacerContainer>(EdPlacer.PlacerContainer::new));
CT_FACTORY_PLACER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_placer"); CT_FACTORY_PLACER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_placer");
CT_FACTORY_HOPPER = (new ContainerType<BlockDecorHopper.DecorHopperContainer>(BlockDecorHopper.DecorHopperContainer::new)); CT_FACTORY_HOPPER = (new ContainerType<EdHopper.HopperContainer>(EdHopper.HopperContainer::new));
CT_FACTORY_HOPPER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_hopper"); CT_FACTORY_HOPPER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_hopper");
CT_SMALL_LAB_FURNACE = (new ContainerType<BlockDecorFurnace.DecorFurnaceContainer>(BlockDecorFurnace.DecorFurnaceContainer::new)); CT_SMALL_LAB_FURNACE = (new ContainerType<EdFurnace.FurnaceContainer>(EdFurnace.FurnaceContainer::new));
CT_SMALL_LAB_FURNACE.setRegistryName(ModEngineersDecor.MODID,"ct_small_lab_furnace"); CT_SMALL_LAB_FURNACE.setRegistryName(ModEngineersDecor.MODID,"ct_small_lab_furnace");
CT_SMALL_ELECTRICAL_FURNACE = (new ContainerType<BlockDecorFurnaceElectrical.DecorFurnaceElectricalContainer>(BlockDecorFurnaceElectrical.DecorFurnaceElectricalContainer::new)); CT_SMALL_ELECTRICAL_FURNACE = (new ContainerType<EdElectricalFurnace.ElectricalFurnaceContainer>(EdElectricalFurnace.ElectricalFurnaceContainer::new));
CT_SMALL_ELECTRICAL_FURNACE.setRegistryName(ModEngineersDecor.MODID,"ct_small_electrical_furnace"); CT_SMALL_ELECTRICAL_FURNACE.setRegistryName(ModEngineersDecor.MODID,"ct_small_electrical_furnace");
CT_WASTE_INCINERATOR = (new ContainerType<BlockDecorWasteIncinerator.BContainer>(BlockDecorWasteIncinerator.BContainer::new)); CT_WASTE_INCINERATOR = (new ContainerType<EdWasteIncinerator.WasteIncineratorContainer>(EdWasteIncinerator.WasteIncineratorContainer::new));
CT_WASTE_INCINERATOR.setRegistryName(ModEngineersDecor.MODID,"ct_small_waste_incinerator"); CT_WASTE_INCINERATOR.setRegistryName(ModEngineersDecor.MODID,"ct_small_waste_incinerator");
CT_LABELED_CRATE = (new ContainerType<BlockDecorLabeledCrate.LabeledCrateContainer>(BlockDecorLabeledCrate.LabeledCrateContainer::new)); CT_LABELED_CRATE = (new ContainerType<EdLabeledCrate.LabeledCrateContainer>(EdLabeledCrate.LabeledCrateContainer::new));
CT_LABELED_CRATE.setRegistryName(ModEngineersDecor.MODID,"ct_labeled_crate"); CT_LABELED_CRATE.setRegistryName(ModEngineersDecor.MODID,"ct_labeled_crate");
} }
@ -953,7 +954,11 @@ public class ModContent
for(Block e:registeredBlocks) { for(Block e:registeredBlocks) {
ResourceLocation rl = e.getRegistryName(); ResourceLocation rl = e.getRegistryName();
if(rl == null) continue; if(rl == null) continue;
event.getRegistry().register(new BlockItem(e, (new BlockItem.Properties().group(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl)); if(e instanceof StandardBlocks.IBlockItemFactory) {
event.getRegistry().register(((StandardBlocks.IBlockItemFactory)e).getBlockItem(e, (new BlockItem.Properties().group(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl));
} else {
event.getRegistry().register(new BlockItem(e, (new BlockItem.Properties().group(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl));
}
++n; ++n;
} }
} }
@ -992,20 +997,20 @@ public class ModContent
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static final void registerContainerGuis(final FMLClientSetupEvent event) public static final void registerContainerGuis(final FMLClientSetupEvent event)
{ {
ScreenManager.registerFactory(CT_TREATED_WOOD_CRAFTING_TABLE, BlockDecorCraftingTable.CraftingTableGui::new); ScreenManager.registerFactory(CT_TREATED_WOOD_CRAFTING_TABLE, EdCraftingTable.CraftingTableGui::new);
ScreenManager.registerFactory(CT_LABELED_CRATE, BlockDecorLabeledCrate.LabeledCrateGui::new); ScreenManager.registerFactory(CT_LABELED_CRATE, EdLabeledCrate.LabeledCrateGui::new);
ScreenManager.registerFactory(CT_FACTORY_DROPPER, BlockDecorDropper.BGui::new); ScreenManager.registerFactory(CT_FACTORY_DROPPER, EdDropper.DropperGui::new);
ScreenManager.registerFactory(CT_FACTORY_PLACER, BlockDecorPlacer.BGui::new); ScreenManager.registerFactory(CT_FACTORY_PLACER, EdPlacer.PlacerGui::new);
ScreenManager.registerFactory(CT_FACTORY_HOPPER, BlockDecorHopper.DecorHopperGui::new); ScreenManager.registerFactory(CT_FACTORY_HOPPER, EdHopper.HopperGui::new);
ScreenManager.registerFactory(CT_SMALL_LAB_FURNACE, BlockDecorFurnace.DecorFurnaceGui::new); ScreenManager.registerFactory(CT_SMALL_LAB_FURNACE, EdFurnace.FurnaceGui::new);
ScreenManager.registerFactory(CT_SMALL_ELECTRICAL_FURNACE, BlockDecorFurnaceElectrical.DecorFurnaceElectricalGui::new); ScreenManager.registerFactory(CT_SMALL_ELECTRICAL_FURNACE, EdElectricalFurnace.ElectricalFurnaceGui::new);
ScreenManager.registerFactory(CT_WASTE_INCINERATOR, BlockDecorWasteIncinerator.BGui::new); ScreenManager.registerFactory(CT_WASTE_INCINERATOR, EdWasteIncinerator.WasteIncineratorGui::new);
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static final void registerTileEntityRenderers(final FMLClientSetupEvent event) public static final void registerTileEntityRenderers(final FMLClientSetupEvent event)
{ {
ClientRegistry.bindTileEntitySpecialRenderer(BlockDecorCraftingTable.CraftingTableTileEntity.class, new wile.engineersdecor.detail.ModTesrs.TesrDecorCraftingTable()); ClientRegistry.bindTileEntitySpecialRenderer(EdCraftingTable.CraftingTableTileEntity.class, new wile.engineersdecor.detail.ModTesrs.TesrDecorCraftingTable());
ClientRegistry.bindTileEntitySpecialRenderer(BlockDecorLabeledCrate.LabeledCrateTileEntity.class, new wile.engineersdecor.detail.ModTesrs.TesrDecorLabeledCrate()); ClientRegistry.bindTileEntitySpecialRenderer(EdLabeledCrate.LabeledCrateTileEntity.class, new wile.engineersdecor.detail.ModTesrs.TesrDecorLabeledCrate());
} }
} }

View file

@ -1,7 +1,6 @@
package wile.engineersdecor; package wile.engineersdecor;
import wile.engineersdecor.blocks.*; import wile.engineersdecor.blocks.*;
import wile.engineersdecor.detail.ModConfig;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import wile.engineersdecor.libmc.detail.OptionalRecipeCondition; import wile.engineersdecor.libmc.detail.OptionalRecipeCondition;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
@ -158,7 +157,7 @@ public class ModEngineersDecor
if(!(event.getEntity() instanceof PlayerEntity)) return; if(!(event.getEntity() instanceof PlayerEntity)) return;
final PlayerEntity player = (PlayerEntity)event.getEntity(); final PlayerEntity player = (PlayerEntity)event.getEntity();
if(player.world == null) return; if(player.world == null) return;
if(player.isOnLadder()) BlockDecorLadder.onPlayerUpdateEvent(player); if(player.isOnLadder()) EdLadderBlock.onPlayerUpdateEvent(player);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFull.java * @file DecorBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.function.Supplier; import java.util.function.Supplier;
public class BlockDecor extends StandardBlocks.BaseBlock implements IDecorBlock public class DecorBlock
{ {
public static final long CFG_DEFAULT = StandardBlocks.CFG_DEFAULT; public static final long CFG_DEFAULT = StandardBlocks.CFG_DEFAULT;
public static final long CFG_CUTOUT = StandardBlocks.CFG_CUTOUT; public static final long CFG_CUTOUT = StandardBlocks.CFG_CUTOUT;
@ -39,17 +39,20 @@ public class BlockDecor extends StandardBlocks.BaseBlock implements IDecorBlock
public static final long CFG_STRICT_CONNECTIONS = StandardBlocks.CFG_STRICT_CONNECTIONS; public static final long CFG_STRICT_CONNECTIONS = StandardBlocks.CFG_STRICT_CONNECTIONS;
public static final long CFG_HARD_IE_DEPENDENT = 0x8000000000000000L; public static final long CFG_HARD_IE_DEPENDENT = 0x8000000000000000L;
public BlockDecor(long conf, Block.Properties properties) public static class Normal extends StandardBlocks.BaseBlock implements IDecorBlock
{ super(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); } {
public Normal(long conf, Block.Properties properties)
{ super(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); }
public BlockDecor(long conf, Block.Properties properties, AxisAlignedBB aabb) public Normal(long conf, Block.Properties properties, AxisAlignedBB aabb)
{ super(conf, properties, aabb);} { super(conf, properties, aabb);}
public BlockDecor(long conf, Block.Properties properties, VoxelShape voxel_shape) public Normal(long conf, Block.Properties properties, VoxelShape voxel_shape)
{ super(conf, properties, voxel_shape); } { super(conf, properties, voxel_shape); }
public BlockDecor(long conf, Block.Properties properties, AxisAlignedBB[] aabbs) public Normal(long conf, Block.Properties properties, AxisAlignedBB[] aabbs)
{ super(conf, properties, aabbs); } { super(conf, properties, aabbs); }
}
public static class WaterLoggable extends StandardBlocks.WaterLoggable implements IStandardBlock, IWaterLoggable public static class WaterLoggable extends StandardBlocks.WaterLoggable implements IStandardBlock, IWaterLoggable
{ {

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorBreaker.java * @file EdBreaker.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -8,9 +8,9 @@
*/ */
package wile.engineersdecor.blocks; package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import wile.engineersdecor.libmc.detail.Overlay; import wile.engineersdecor.libmc.detail.Overlay;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
@ -47,86 +47,94 @@ import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockDecorBreaker extends StandardBlocks.HorizontalWaterLoggable implements IDecorBlock public class EdBreaker
{ {
public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorBreaker(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) public static class BreakerBlock extends StandardBlocks.HorizontalWaterLoggable implements IDecorBlock
{ super(config, builder, unrotatedAABBs); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(ACTIVE); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(ACTIVE, false); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{ {
if((state.getBlock()!=this) || (!state.get(ACTIVE))) return; public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
final double rv = rnd.nextDouble();
if(rv > 0.8) return; public BreakerBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ(); { super(config, builder, unrotatedAABBs); }
final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2);
switch(state.get(HORIZONTAL_FACING)) { @Override
case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break; protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break; { super.fillStateContainer(builder); builder.add(ACTIVE); }
case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break;
default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break; @Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(ACTIVE, false); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BreakerTileEntity(); }
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{
if((state.getBlock()!=this) || (!state.get(ACTIVE))) return;
final double rv = rnd.nextDouble();
if(rv > 0.8) return;
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ();
final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2);
switch(state.get(HORIZONTAL_FACING)) {
case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break;
case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break;
case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break;
default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break;
}
} }
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{ {
if(!(world instanceof World) || (((World) world).isRemote)) return; if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return; if(!(te instanceof BreakerTileEntity)) return;
((BTileEntity)te).block_updated(); ((BreakerTileEntity)te).block_updated();
} }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state) public boolean canProvidePower(BlockState state)
{ return true; } { return true; }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; } { return 0; }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; } { return 0; }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof BreakerTileEntity) ((BreakerTileEntity)te).state_message(player);
return true;
}
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof BTileEntity) ((BTileEntity)te).state_message(player);
return true;
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage public static class BreakerTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage
{ {
public static final int IDLE_TICK_INTERVAL = 40; public static final int IDLE_TICK_INTERVAL = 40;
public static final int TICK_INTERVAL = 5; public static final int TICK_INTERVAL = 5;
@ -156,10 +164,10 @@ public class BlockDecorBreaker extends StandardBlocks.HorizontalWaterLoggable im
ModEngineersDecor.logger().info("Config block breaker: Boost energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t, reluctance=" + breaking_reluctance + "t/hrdn, break time offset=" + min_breaking_time + "t"); ModEngineersDecor.logger().info("Config block breaker: Boost energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t, reluctance=" + breaking_reluctance + "t/hrdn, break time offset=" + min_breaking_time + "t");
} }
public BTileEntity() public BreakerTileEntity()
{ super(ModContent.TET_SMALL_BLOCK_BREAKER); } { super(ModContent.TET_SMALL_BLOCK_BREAKER); }
public BTileEntity(TileEntityType<?> te_type) public BreakerTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void block_updated() public void block_updated()
@ -275,7 +283,7 @@ public class BlockDecorBreaker extends StandardBlocks.HorizontalWaterLoggable im
drops = ((IDecorBlock)block).dropList(state, world, pos, false); drops = ((IDecorBlock)block).dropList(state, world, pos, false);
} }
world.removeBlock(pos, false); world.removeBlock(pos, false);
for(ItemStack drop:drops) spawnAsEntity(world, pos, drop); for(ItemStack drop:drops) Block.spawnAsEntity(world, pos, drop);
SoundType stype = state.getBlock().getSoundType(state, world, pos, null); SoundType stype = state.getBlock().getSoundType(state, world, pos, null);
if(stype != null) world.playSound(null, pos, stype.getPlaceSound(), SoundCategory.BLOCKS, stype.getVolume()*0.6f, stype.getPitch()); if(stype != null) world.playSound(null, pos, stype.getPlaceSound(), SoundCategory.BLOCKS, stype.getVolume()*0.6f, stype.getPitch());
return true; return true;
@ -288,13 +296,13 @@ public class BlockDecorBreaker extends StandardBlocks.HorizontalWaterLoggable im
if(--tick_timer_ > 0) return; if(--tick_timer_ > 0) return;
if(world.isRemote) { if(world.isRemote) {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if(!state.get(ACTIVE)) { if(!state.get(BreakerBlock.ACTIVE)) {
tick_timer_ = TICK_INTERVAL; tick_timer_ = TICK_INTERVAL;
} else { } else {
tick_timer_ = 1; tick_timer_ = 1;
// not sure if is so cool to do this each tick ... may be simplified/removed again. // not sure if is so cool to do this each tick ... may be simplified/removed again.
SoundEvent sound = SoundEvents.BLOCK_WOOD_HIT; SoundEvent sound = SoundEvents.BLOCK_WOOD_HIT;
BlockState target_state = world.getBlockState(pos.offset(state.get(HORIZONTAL_FACING))); BlockState target_state = world.getBlockState(pos.offset(state.get(BreakerBlock.HORIZONTAL_FACING)));
SoundType stype = target_state.getBlock().getSoundType(target_state); SoundType stype = target_state.getBlock().getSoundType(target_state);
if((stype == SoundType.CLOTH) || (stype == SoundType.PLANT) || (stype == SoundType.SNOW)) { if((stype == SoundType.CLOTH) || (stype == SoundType.PLANT) || (stype == SoundType.SNOW)) {
sound = SoundEvents.BLOCK_WOOL_HIT; sound = SoundEvents.BLOCK_WOOL_HIT;
@ -306,10 +314,10 @@ public class BlockDecorBreaker extends StandardBlocks.HorizontalWaterLoggable im
} else { } else {
tick_timer_ = TICK_INTERVAL; tick_timer_ = TICK_INTERVAL;
final BlockState device_state = world.getBlockState(pos); final BlockState device_state = world.getBlockState(pos);
final BlockPos target_pos = pos.offset(device_state.get(HORIZONTAL_FACING)); final BlockPos target_pos = pos.offset(device_state.get(BreakerBlock.HORIZONTAL_FACING));
final BlockState target_state = world.getBlockState(target_pos); final BlockState target_state = world.getBlockState(target_pos);
if((world.isBlockPowered(pos)) || (!isBreakable(target_state, target_pos, world))) { if((world.isBlockPowered(pos)) || (!isBreakable(target_state, target_pos, world))) {
if(device_state.get(ACTIVE)) world.setBlockState(pos, device_state.with(ACTIVE, false), 1|2); if(device_state.get(BreakerBlock.ACTIVE)) world.setBlockState(pos, device_state.with(BreakerBlock.ACTIVE, false), 1|2);
proc_time_elapsed_ = 0; proc_time_elapsed_ = 0;
tick_timer_ = IDLE_TICK_INTERVAL; tick_timer_ = IDLE_TICK_INTERVAL;
return; return;
@ -335,8 +343,8 @@ public class BlockDecorBreaker extends StandardBlocks.HorizontalWaterLoggable im
breakBlock(target_state, target_pos, world); breakBlock(target_state, target_pos, world);
active = false; active = false;
} }
if(device_state.get(ACTIVE) != active) { if(device_state.get(BreakerBlock.ACTIVE) != active) {
world.setBlockState(pos, device_state.with(ACTIVE, active), 1|2); world.setBlockState(pos, device_state.with(BreakerBlock.ACTIVE, active), 1|2);
} }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFull.java * @file EdChair.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -29,7 +29,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockDecorChair extends StandardBlocks.HorizontalWaterLoggable implements IDecorBlock public class EdChair
{ {
private static boolean sitting_enabled = true; private static boolean sitting_enabled = true;
private static double sitting_probability = 0.1; private static double sitting_probability = 0.1;
@ -43,45 +43,53 @@ public class BlockDecorChair extends StandardBlocks.HorizontalWaterLoggable impl
ModEngineersDecor.logger().info("Config chairs: " + sitting_enabled + ", sit: " + sitting_probability, ", stand up: " + standup_probability); ModEngineersDecor.logger().info("Config chairs: " + sitting_enabled + ", sit: " + sitting_probability, ", stand up: " + standup_probability);
} }
public BlockDecorChair(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) //--------------------------------------------------------------------------------------------------------------------
{ super(config, builder.tickRandomly(), unrotatedAABBs); } // Block
//--------------------------------------------------------------------------------------------------------------------
@Override public static class ChairBlock extends StandardBlocks.HorizontalWaterLoggable implements IDecorBlock
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(sitting_enabled && (!world.isRemote)) { EntityChair.sit(world, player, pos); } public ChairBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
return true; { super(config, builder.tickRandomly(), unrotatedAABBs); }
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(sitting_enabled && (Math.random() < sitting_probability) && (entity instanceof MobEntity)) EntityChair.sit(world, (LivingEntity)entity, pos); if(sitting_enabled && (!world.isRemote)) { ChairEntity.sit(world, player, pos); }
} return true;
}
@Override @Override
public int tickRate(IWorldReader world) @SuppressWarnings("deprecation")
{ return 10; } public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity)
{
if(sitting_enabled && (Math.random() < sitting_probability) && (entity instanceof MobEntity)) ChairEntity.sit(world, (LivingEntity)entity, pos);
}
@Override
public int tickRate(IWorldReader world)
{ return 10; }
@Override
@SuppressWarnings("deprecation")
public void tick(BlockState state, World world, BlockPos pos, Random rnd)
{
if((!sitting_enabled) || (sitting_probability < 1e-6)) return;
final List<LivingEntity> entities = world.getEntitiesWithinAABB(MobEntity.class, new AxisAlignedBB(pos).grow(2,1,2).expand(0,1,0), e->true);
if(entities.isEmpty()) return;
int index = rnd.nextInt(entities.size());
if((index < 0) || (index >= entities.size())) return;
ChairEntity.sit(world, entities.get(index), pos);
}
@Override
@SuppressWarnings("deprecation")
public void tick(BlockState state, World world, BlockPos pos, Random rnd)
{
if((!sitting_enabled) || (sitting_probability < 1e-6)) return;
final List<LivingEntity> entities = world.getEntitiesWithinAABB(MobEntity.class, new AxisAlignedBB(pos).grow(2,1,2).expand(0,1,0), e->true);
if(entities.isEmpty()) return;
int index = rnd.nextInt(entities.size());
if((index < 0) || (index >= entities.size())) return;
EntityChair.sit(world, entities.get(index), pos);
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Riding entity for sitting // Entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class EntityChair extends Entity public static class ChairEntity extends Entity
{ {
public static final double x_offset = 0.5d; public static final double x_offset = 0.5d;
public static final double y_offset = 0.4d; public static final double y_offset = 0.4d;
@ -89,7 +97,7 @@ public class BlockDecorChair extends StandardBlocks.HorizontalWaterLoggable impl
private int t_sit = 0; private int t_sit = 0;
public BlockPos chair_pos = new BlockPos(0,0,0); public BlockPos chair_pos = new BlockPos(0,0,0);
public EntityChair(EntityType<? extends Entity> entityType, World world) public ChairEntity(EntityType<? extends Entity> entityType, World world)
{ {
super(entityType, world); super(entityType, world);
preventEntitySpawning=true; preventEntitySpawning=true;
@ -98,11 +106,11 @@ public class BlockDecorChair extends StandardBlocks.HorizontalWaterLoggable impl
noClip=true; noClip=true;
} }
public EntityChair(World world) public ChairEntity(World world)
{ this(ModContent.ET_CHAIR, world); } { this(ModContent.ET_CHAIR, world); }
public static EntityChair customClientFactory(FMLPlayMessages.SpawnEntity spkt, World world) public static ChairEntity customClientFactory(FMLPlayMessages.SpawnEntity spkt, World world)
{ return new EntityChair(world); } { return new ChairEntity(world); }
public IPacket<?> createSpawnPacket() public IPacket<?> createSpawnPacket()
{ return NetworkHooks.getEntitySpawningPacket(this); } { return NetworkHooks.getEntitySpawningPacket(this); }
@ -126,12 +134,12 @@ public class BlockDecorChair extends StandardBlocks.HorizontalWaterLoggable impl
if(!sitting_enabled) return; if(!sitting_enabled) return;
if((world==null) || (world.isRemote) || (sitter==null) || (pos==null)) return; if((world==null) || (world.isRemote) || (sitter==null) || (pos==null)) return;
if((!(sitter instanceof PlayerEntity)) && (!accepts_mob(sitter))) return; if((!(sitter instanceof PlayerEntity)) && (!accepts_mob(sitter))) return;
if(!world.getEntitiesWithinAABB(EntityChair.class, new AxisAlignedBB(pos)).isEmpty()) return; if(!world.getEntitiesWithinAABB(ChairEntity.class, new AxisAlignedBB(pos)).isEmpty()) return;
if(sitter.isBeingRidden() || (!sitter.isAlive()) || (sitter.isPassenger()) ) return; if(sitter.isBeingRidden() || (!sitter.isAlive()) || (sitter.isPassenger()) ) return;
if((!world.isAirBlock(pos.up())) || (!world.isAirBlock(pos.up(2)))) return; if((!world.isAirBlock(pos.up())) || (!world.isAirBlock(pos.up(2)))) return;
boolean on_top_of_block_position = true; boolean on_top_of_block_position = true;
boolean use_next_negative_y_position = false; boolean use_next_negative_y_position = false;
EntityChair chair = new EntityChair(world); ChairEntity chair = new ChairEntity(world);
chair.chair_pos = pos; chair.chair_pos = pos;
chair.t_sit = 5; chair.t_sit = 5;
chair.prevPosX = chair.posX; chair.prevPosX = chair.posX;
@ -176,7 +184,7 @@ public class BlockDecorChair extends StandardBlocks.HorizontalWaterLoggable impl
} }
boolean abort = (!sitting_enabled); boolean abort = (!sitting_enabled);
final BlockState state = world.getBlockState(chair_pos); final BlockState state = world.getBlockState(chair_pos);
if((state==null) || (!(state.getBlock() instanceof BlockDecorChair))) abort = true; if((state==null) || (!(state.getBlock() instanceof ChairBlock))) abort = true;
if(!world.isAirBlock(chair_pos.up())) abort = true; if(!world.isAirBlock(chair_pos.up())) abort = true;
if((!(sitter instanceof PlayerEntity)) && (Math.random() < standup_probability)) abort = true; if((!(sitter instanceof PlayerEntity)) && (Math.random() < standup_probability)) abort = true;
if(abort) { if(abort) {

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorDirected.java * @file EdCraftingTable.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -66,7 +66,7 @@ import java.util.stream.Collectors;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
public class BlockDecorCraftingTable public class EdCraftingTable
{ {
public static boolean with_assist = true; public static boolean with_assist = true;
public static boolean with_assist_direct_history_refab = false; public static boolean with_assist_direct_history_refab = false;
@ -101,7 +101,7 @@ public class BlockDecorCraftingTable
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorCraftingTable.CraftingTableTileEntity(); } { return new EdCraftingTable.CraftingTableTileEntity(); }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -317,6 +317,20 @@ public class BlockDecorCraftingTable
public static class CraftingTableContainer extends Container implements Networking.INetworkSynchronisableContainer public static class CraftingTableContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
protected static final String BUTTON_NEXT = "next";
protected static final String BUTTON_PREV = "prev";
protected static final String BUTTON_CLEAR_GRID = "clear";
protected static final String BUTTON_FROM_STORAGE = "from-storage";
protected static final String BUTTON_TO_STORAGE = "to-storage";
protected static final String BUTTON_FROM_PLAYER = "from-player";
protected static final String BUTTON_TO_PLAYER = "to-player";
protected static final String BUTTON_NEXT_COLLISION_RECIPE = "next-recipe";
protected static final String ACTION_PLACE_CURRENT_HISTORY_SEL = "place-refab";
protected static final String ACTION_PLACE_SHIFTCLICKED_STACK = "place-stack";
protected static final String ACTION_MOVE_ALL_STACKS = "move-stacks";
protected static final String ACTION_INCREASE_CRAFTING_STACKS = "inc-crafting-stacks";
protected static final String ACTION_DECREASE_CRAFTING_STACKS = "dec-crafting-stacks";
public static final int CRAFTING_SLOTS_BEGIN = 0; public static final int CRAFTING_SLOTS_BEGIN = 0;
public static final int NUM_OF_CRAFTING_SLOTS = 9; public static final int NUM_OF_CRAFTING_SLOTS = 9;
public static final int STORAGE_SLOTS_BEGIN = NUM_OF_CRAFTING_SLOTS; public static final int STORAGE_SLOTS_BEGIN = NUM_OF_CRAFTING_SLOTS;
@ -513,39 +527,39 @@ public class BlockDecorCraftingTable
boolean player_inventory_changed = false; boolean player_inventory_changed = false;
if(with_assist && nbt.contains("action")) { if(with_assist && nbt.contains("action")) {
switch(nbt.getString("action")) { switch(nbt.getString("action")) {
case CraftingTableGui.BUTTON_NEXT: { case BUTTON_NEXT: {
history_.next(); history_.next();
syncHistory(); syncHistory();
// implicitly clear the grid, so that the player can see the refab, and that no recipe is active. // implicitly clear the grid, so that the player can see the refab, and that no recipe is active.
if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) changed = true; if(clear_grid_to_storage(player)) changed = true;
} break; } break;
case CraftingTableGui.BUTTON_PREV: { case BUTTON_PREV: {
history_.prev(); history_.prev();
syncHistory(); syncHistory();
if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) changed = true; if(clear_grid_to_storage(player)) changed = true;
} break; } break;
case CraftingTableGui.BUTTON_CLEAR_GRID: { case BUTTON_CLEAR_GRID: {
history_.reset_selection(); history_.reset_selection();
syncHistory(); syncHistory();
if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) changed = true; if(clear_grid_to_storage(player)) changed = true;
} break; } break;
case CraftingTableGui.BUTTON_TO_STORAGE: { case BUTTON_TO_STORAGE: {
if(clear_grid_to_storage(player)) changed = true; if(clear_grid_to_storage(player)) changed = true;
} break; } break;
case CraftingTableGui.BUTTON_TO_PLAYER: { case BUTTON_TO_PLAYER: {
if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; }
} break; } break;
case CraftingTableGui.BUTTON_FROM_STORAGE: { case BUTTON_FROM_STORAGE: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(inventory_, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS) new SlotRange(inventory_, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS)
}, refab_crafting_stacks()) != PlacementResult.UNCHANGED) { }, refab_crafting_stacks()) != PlacementResult.UNCHANGED) {
changed = true; changed = true;
} }
} break; } break;
case CraftingTableGui.BUTTON_FROM_PLAYER: { case BUTTON_FROM_PLAYER: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9) new SlotRange(player.inventory, 0, 9)
@ -553,7 +567,7 @@ public class BlockDecorCraftingTable
changed = true; player_inventory_changed = true; changed = true; player_inventory_changed = true;
} }
} break; } break;
case CraftingTableGui.ACTION_PLACE_CURRENT_HISTORY_SEL: { case ACTION_PLACE_CURRENT_HISTORY_SEL: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
@ -562,7 +576,7 @@ public class BlockDecorCraftingTable
changed = true; changed = true;
} }
} break; } break;
case CraftingTableGui.ACTION_PLACE_SHIFTCLICKED_STACK: { case ACTION_PLACE_SHIFTCLICKED_STACK: {
final int container_slot_id = nbt.getInt("containerslot"); final int container_slot_id = nbt.getInt("containerslot");
if((container_slot_id < 10) || (container_slot_id > 53)) { if((container_slot_id < 10) || (container_slot_id > 53)) {
break; // out of range break; // out of range
@ -589,7 +603,7 @@ public class BlockDecorCraftingTable
} }
} }
} break; } break;
case CraftingTableGui.ACTION_MOVE_ALL_STACKS: { case ACTION_MOVE_ALL_STACKS: {
final int container_slot_id = nbt.getInt("containerslot"); final int container_slot_id = nbt.getInt("containerslot");
if((container_slot_id < 1) || (container_slot_id > 53)) { if((container_slot_id < 1) || (container_slot_id > 53)) {
break; // out of range break; // out of range
@ -634,17 +648,17 @@ public class BlockDecorCraftingTable
} }
} }
} break; } break;
case CraftingTableGui.BUTTON_NEXT_COLLISION_RECIPE: { case BUTTON_NEXT_COLLISION_RECIPE: {
select_next_collision_recipe(inventory_); select_next_collision_recipe(inventory_);
} break; } break;
case CraftingTableGui.ACTION_DECREASE_CRAFTING_STACKS: { case ACTION_DECREASE_CRAFTING_STACKS: {
changed = player_inventory_changed = decrease_grid_stacks(new SlotRange[]{ changed = player_inventory_changed = decrease_grid_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),
new SlotRange(inventory_, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS) new SlotRange(inventory_, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS)
}, MathHelper.clamp(nbt.getInt("limit"), 1, 8)); }, MathHelper.clamp(nbt.getInt("limit"), 1, 8));
} break; } break;
case CraftingTableGui.ACTION_INCREASE_CRAFTING_STACKS: { case ACTION_INCREASE_CRAFTING_STACKS: {
changed = player_inventory_changed = increase_grid_stacks(new SlotRange[]{ changed = player_inventory_changed = increase_grid_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),
@ -1089,19 +1103,6 @@ public class BlockDecorCraftingTable
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class CraftingTableGui extends ContainerScreen<CraftingTableContainer> public static class CraftingTableGui extends ContainerScreen<CraftingTableContainer>
{ {
protected static final String BUTTON_NEXT = "next";
protected static final String BUTTON_PREV = "prev";
protected static final String BUTTON_CLEAR_GRID = "clear";
protected static final String BUTTON_FROM_STORAGE = "from-storage";
protected static final String BUTTON_TO_STORAGE = "to-storage";
protected static final String BUTTON_FROM_PLAYER = "from-player";
protected static final String BUTTON_TO_PLAYER = "to-player";
protected static final String BUTTON_NEXT_COLLISION_RECIPE = "next-recipe";
protected static final String ACTION_PLACE_CURRENT_HISTORY_SEL = "place-refab";
protected static final String ACTION_PLACE_SHIFTCLICKED_STACK = "place-stack";
protected static final String ACTION_MOVE_ALL_STACKS = "move-stacks";
protected static final String ACTION_INCREASE_CRAFTING_STACKS = "inc-crafting-stacks";
protected static final String ACTION_DECREASE_CRAFTING_STACKS = "dec-crafting-stacks";
protected static final ResourceLocation BACKGROUND = new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/treated_wood_crafting_table.png"); protected static final ResourceLocation BACKGROUND = new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/treated_wood_crafting_table.png");
protected final PlayerEntity player; protected final PlayerEntity player;
protected final ArrayList<Button> buttons = new ArrayList<Button>(); protected final ArrayList<Button> buttons = new ArrayList<Button>();
@ -1120,15 +1121,15 @@ public class BlockDecorCraftingTable
final int x0=guiLeft, y0=guiTop; final int x0=guiLeft, y0=guiTop;
buttons.clear(); buttons.clear();
if(with_assist) { if(with_assist) {
buttons.add(addButton(new ImageButton(x0+158,y0+44, 12,12, 194,44, 12, BACKGROUND, (bt)->action(BUTTON_NEXT)))); buttons.add(addButton(new ImageButton(x0+158,y0+44, 12,12, 194,44, 12, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_NEXT))));
buttons.add(addButton(new ImageButton(x0+158,y0+30, 12,12, 180,30, 12, BACKGROUND, (bt)->action(BUTTON_PREV)))); buttons.add(addButton(new ImageButton(x0+158,y0+30, 12,12, 180,30, 12, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_PREV))));
buttons.add(addButton(new ImageButton(x0+158,y0+58, 12,12, 194,8, 12, BACKGROUND, (bt)->action(BUTTON_CLEAR_GRID)))); buttons.add(addButton(new ImageButton(x0+158,y0+58, 12,12, 194,8, 12, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_CLEAR_GRID))));
buttons.add(addButton(new ImageButton(x0+132,y0+18, 20,10, 183,95, 12, BACKGROUND, (bt)->action(BUTTON_NEXT_COLLISION_RECIPE)))); buttons.add(addButton(new ImageButton(x0+132,y0+18, 20,10, 183,95, 12, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_NEXT_COLLISION_RECIPE))));
if(with_assist_quickmove_buttons) { if(with_assist_quickmove_buttons) {
buttons.add(addButton(new ImageButton(x0+49, y0+34, 9,17, 219,34, 17, BACKGROUND, (bt)->action(BUTTON_FROM_STORAGE)))); buttons.add(addButton(new ImageButton(x0+49, y0+34, 9,17, 219,34, 17, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_FROM_STORAGE))));
buttons.add(addButton(new ImageButton(x0+49, y0+52, 9,17, 208,16, 17, BACKGROUND, (bt)->action(BUTTON_TO_STORAGE)))); buttons.add(addButton(new ImageButton(x0+49, y0+52, 9,17, 208,16, 17, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_TO_STORAGE))));
buttons.add(addButton(new ImageButton(x0+77, y0+71, 17, 9, 198,71, 9, BACKGROUND, (bt)->action(BUTTON_FROM_PLAYER)))); buttons.add(addButton(new ImageButton(x0+77, y0+71, 17, 9, 198,71, 9, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_FROM_PLAYER))));
buttons.add(addButton(new ImageButton(x0+59, y0+71, 17, 9, 180,71, 9, BACKGROUND, (bt)->action(BUTTON_TO_PLAYER)))); buttons.add(addButton(new ImageButton(x0+59, y0+71, 17, 9, 180,71, 9, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_TO_PLAYER))));
} }
} }
} }
@ -1261,14 +1262,14 @@ public class BlockDecorCraftingTable
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("containerslot", slotId); nbt.putInt("containerslot", slotId);
if(Auxiliaries.isCtrlDown()) nbt.putBoolean("move-all", true); if(Auxiliaries.isCtrlDown()) nbt.putBoolean("move-all", true);
action(ACTION_PLACE_SHIFTCLICKED_STACK, nbt); action(CraftingTableContainer.ACTION_PLACE_SHIFTCLICKED_STACK, nbt);
return; return;
} else if(Auxiliaries.isCtrlDown()) { } else if(Auxiliaries.isCtrlDown()) {
// Move all same items from the inventory of the clicked slot // Move all same items from the inventory of the clicked slot
// (or the crafting grid) to the corresponding target inventory. // (or the crafting grid) to the corresponding target inventory.
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("containerslot", slotId); nbt.putInt("containerslot", slotId);
action(ACTION_MOVE_ALL_STACKS, nbt); action(CraftingTableContainer.ACTION_MOVE_ALL_STACKS, nbt);
return; return;
} else { } else {
// Let the normal slot click handle that. // Let the normal slot click handle that.
@ -1294,16 +1295,16 @@ public class BlockDecorCraftingTable
if((count < resultSlot.getStack().getMaxStackSize()) && (count < resultSlot.getSlotStackLimit())) { if((count < resultSlot.getStack().getMaxStackSize()) && (count < resultSlot.getSlotStackLimit())) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
if(limit > 1) nbt.putInt("limit", limit); if(limit > 1) nbt.putInt("limit", limit);
action(ACTION_INCREASE_CRAFTING_STACKS, nbt); action(CraftingTableContainer.ACTION_INCREASE_CRAFTING_STACKS, nbt);
} }
} else if(!getContainer().history().current().isEmpty()) { } else if(!getContainer().history().current().isEmpty()) {
action(ACTION_PLACE_CURRENT_HISTORY_SEL); action(CraftingTableContainer.ACTION_PLACE_CURRENT_HISTORY_SEL);
} }
} else if(wheel_inc < -0.1) { } else if(wheel_inc < -0.1) {
if(count > 0) { if(count > 0) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
if(limit > 1) nbt.putInt("limit", limit); if(limit > 1) nbt.putInt("limit", limit);
action(ACTION_DECREASE_CRAFTING_STACKS, nbt); action(CraftingTableContainer.ACTION_DECREASE_CRAFTING_STACKS, nbt);
} }
} }
return true; return true;
@ -1314,7 +1315,7 @@ public class BlockDecorCraftingTable
if((getContainer().history().current().isEmpty())) return; if((getContainer().history().current().isEmpty())) return;
final Slot resultSlot = this.getSlotUnderMouse(); // double check final Slot resultSlot = this.getSlotUnderMouse(); // double check
if(!(resultSlot instanceof CraftingResultSlot)) return; if(!(resultSlot instanceof CraftingResultSlot)) return;
action(ACTION_PLACE_CURRENT_HISTORY_SEL); action(CraftingTableContainer.ACTION_PLACE_CURRENT_HISTORY_SEL);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorDoubleGate.java * @file EdDoubleGateBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -33,7 +33,7 @@ import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
public class BlockDecorDoubleGate extends BlockDecor.HorizontalWaterLoggable implements IDecorBlock public class EdDoubleGateBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock
{ {
public static final IntegerProperty SEGMENT = IntegerProperty.create("segment", 0, 1); public static final IntegerProperty SEGMENT = IntegerProperty.create("segment", 0, 1);
public static final BooleanProperty OPEN = FenceGateBlock.OPEN; public static final BooleanProperty OPEN = FenceGateBlock.OPEN;
@ -41,10 +41,10 @@ public class BlockDecorDoubleGate extends BlockDecor.HorizontalWaterLoggable imp
public static final int SEGMENT_UPPER = 1; public static final int SEGMENT_UPPER = 1;
protected final ArrayList<VoxelShape> collision_shapes_; protected final ArrayList<VoxelShape> collision_shapes_;
public BlockDecorDoubleGate(long config, Block.Properties properties, AxisAlignedBB aabb) public EdDoubleGateBlock(long config, Block.Properties properties, AxisAlignedBB aabb)
{ this(config, properties, new AxisAlignedBB[]{aabb}); } { this(config, properties, new AxisAlignedBB[]{aabb}); }
public BlockDecorDoubleGate(long config, Block.Properties properties, AxisAlignedBB[] aabbs) public EdDoubleGateBlock(long config, Block.Properties properties, AxisAlignedBB[] aabbs)
{ {
super(config, properties, aabbs); super(config, properties, aabbs);
AxisAlignedBB[] caabbs = new AxisAlignedBB[aabbs.length]; AxisAlignedBB[] caabbs = new AxisAlignedBB[aabbs.length];

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorDropper.java * @file EdDropper.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -58,135 +58,142 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public class BlockDecorDropper extends StandardBlocks.Directed implements IDecorBlock public class EdDropper
{ {
public static final BooleanProperty OPEN = DoorBlock.OPEN; //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorDropper(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public static class DropperBlock extends StandardBlocks.Directed implements IDecorBlock
{ super(config, builder, unrotatedAABB); }
@Override
@OnlyIn(Dist.CLIENT)
public BlockRenderLayer getRenderLayer()
{ return BlockRenderLayer.SOLID; }
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
{ return VoxelShapes.fullCube(); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(OPEN); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(OPEN, false); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorDropper.BTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{ {
if(world.isRemote) return; public static final BooleanProperty OPEN = DoorBlock.OPEN;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorDropper.BTileEntity)) return;
((BlockDecorDropper.BTileEntity)te).readnbt(te_nbt, false);
((BlockDecorDropper.BTileEntity)te).reset_rtstate();
((BlockDecorDropper.BTileEntity)te).markDirty();
}
@Override public DropperBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
public boolean hasDynamicDropList() { super(config, builder, unrotatedAABB); }
{ return true; }
@Override @Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) @OnlyIn(Dist.CLIENT)
{ public BlockRenderLayer getRenderLayer()
final List<ItemStack> stacks = new ArrayList<ItemStack>(); { return BlockRenderLayer.SOLID; }
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos); @Override
if(!(te instanceof BTileEntity)) return stacks; public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
if(!explosion) { { return VoxelShapes.fullCube(); }
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((BTileEntity) te).clear_getnbt(); @Override
if(!te_nbt.isEmpty()) { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
CompoundNBT nbt = new CompoundNBT(); { super.fillStateContainer(builder); builder.add(OPEN); }
nbt.put("tedata", te_nbt);
stack.setTag(nbt); @Override
} @Nullable
stacks.add(stack); public BlockState getStateForPlacement(BlockItemUseContext context)
} else { { return super.getStateForPlacement(context).with(OPEN, false); }
for(ItemStack stack: ((BTileEntity)te).stacks_) {
if(!stack.isEmpty()) stacks.add(stack); @Override
} @SuppressWarnings("deprecation")
((BTileEntity)te).reset_rtstate(); public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new DropperTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DropperTileEntity)) return;
((DropperTileEntity)te).readnbt(te_nbt, false);
((DropperTileEntity)te).reset_rtstate();
((DropperTileEntity)te).markDirty();
} }
return stacks;
@Override
public boolean hasDynamicDropList()
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DropperTileEntity)) return stacks;
if(!explosion) {
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((DropperTileEntity) te).clear_getnbt();
if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt);
stack.setTag(nbt);
}
stacks.add(stack);
} else {
for(ItemStack stack: ((DropperTileEntity)te).stacks_) {
if(!stack.isEmpty()) stacks.add(stack);
}
((DropperTileEntity)te).reset_rtstate();
}
return stacks;
}
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DropperTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return true;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DropperTileEntity)) return;
((DropperTileEntity)te).block_updated();
}
@Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
@Override
@SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
} }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorDropper.BTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return true;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).block_updated();
}
@Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
@Override
@SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory public static class DropperTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory
{ {
public static final int NUM_OF_FIELDS = 16; public static final int NUM_OF_FIELDS = 16;
public static final int TICK_INTERVAL = 32; public static final int TICK_INTERVAL = 32;
@ -227,10 +234,10 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
// ModEngineersDecor.logger.info("Config factory dropper:"); // ModEngineersDecor.logger.info("Config factory dropper:");
} }
public BTileEntity() public DropperTileEntity()
{ this(ModContent.TET_FACTORY_DROPPER); } { this(ModContent.TET_FACTORY_DROPPER); }
public BTileEntity(TileEntityType<?> te_type) public DropperTileEntity(TileEntityType<?> te_type)
{ {
super(te_type); super(te_type);
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
@ -338,7 +345,7 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new DropperContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------------------- // IInventory -------------------------------------------------------------------------------------------
@ -401,7 +408,7 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(BTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(DropperTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
@ -516,10 +523,10 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
BlockState update_blockstate() BlockState update_blockstate()
{ {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if(!(state.getBlock() instanceof BlockDecorDropper)) return null; if(!(state.getBlock() instanceof EdDropper.DropperBlock)) return null;
boolean open = (open_timer_ > 0); boolean open = (open_timer_ > 0);
if(state.get(OPEN) != open) { if(state.get(DropperBlock.OPEN) != open) {
state = state.with(OPEN, open); state = state.with(DropperBlock.OPEN, open);
world.setBlockState(pos, state, 2|16); world.setBlockState(pos, state, 2|16);
if((drop_logic_ & DROPLOGIC_SILENT_OPEN) == 0) { if((drop_logic_ & DROPLOGIC_SILENT_OPEN) == 0) {
if(open) { if(open) {
@ -653,7 +660,7 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
for(int i = 0; i < drop_stacks.length; ++i) { for(int i = 0; i < drop_stacks.length; ++i) {
if(drop_stacks[i].isEmpty()) continue; if(drop_stacks[i].isEmpty()) continue;
dirty = true; dirty = true;
drop(world, pos, state.get(FACING), drop_stacks[i], drop_speed_, drop_xdev_, drop_ydev_, drop_noise_); drop(world, pos, state.get(DropperBlock.FACING), drop_stacks[i], drop_speed_, drop_xdev_, drop_ydev_, drop_noise_);
dropped = true; dropped = true;
} }
// cooldown // cooldown
@ -674,12 +681,12 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BContainer extends Container implements Networking.INetworkSynchronisableContainer public static class DropperContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
private static final int PLAYER_INV_START_SLOTNO = BTileEntity.NUM_OF_SLOTS; private static final int PLAYER_INV_START_SLOTNO = DropperTileEntity.NUM_OF_SLOTS;
private final PlayerEntity player_; private final PlayerEntity player_;
private final IInventory inventory_; private final IInventory inventory_;
private final IWorldPosCallable wpc_; private final IWorldPosCallable wpc_;
@ -687,10 +694,10 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
public final int field(int index) { return fields_.get(index); } public final int field(int index) { return fields_.get(index); }
public BContainer(int cid, PlayerInventory player_inventory) public DropperContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(BTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(BTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(DropperTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(DropperTileEntity.NUM_OF_FIELDS)); }
private BContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private DropperContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_FACTORY_DROPPER, cid); super(ModContent.CT_FACTORY_DROPPER, cid);
fields_ = fields; fields_ = fields;
@ -737,7 +744,7 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player slot // Player slot
if(!mergeItemStack(slot_stack, 0, BTileEntity.INPUT_SLOTS_SIZE, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, 0, DropperTileEntity.INPUT_SLOTS_SIZE, false)) return ItemStack.EMPTY;
} else { } else {
// invalid slot // invalid slot
return ItemStack.EMPTY; return ItemStack.EMPTY;
@ -773,12 +780,12 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
@Override @Override
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
{ {
if(!(inventory_ instanceof BTileEntity)) return; if(!(inventory_ instanceof DropperTileEntity)) return;
BTileEntity te = (BTileEntity)inventory_; DropperTileEntity te = (DropperTileEntity)inventory_;
if(nbt.contains("drop_speed")) te.drop_speed_ = MathHelper.clamp(nbt.getInt("drop_speed"), 0, 100); if(nbt.contains("drop_speed")) te.drop_speed_ = MathHelper.clamp(nbt.getInt("drop_speed"), 0, 100);
if(nbt.contains("drop_xdev")) te.drop_xdev_ = MathHelper.clamp(nbt.getInt("drop_xdev"), -100, 100); if(nbt.contains("drop_xdev")) te.drop_xdev_ = MathHelper.clamp(nbt.getInt("drop_xdev"), -100, 100);
if(nbt.contains("drop_ydev")) te.drop_ydev_ = MathHelper.clamp(nbt.getInt("drop_ydev"), -100, 100); if(nbt.contains("drop_ydev")) te.drop_ydev_ = MathHelper.clamp(nbt.getInt("drop_ydev"), -100, 100);
if(nbt.contains("drop_count")) te.drop_count_ = MathHelper.clamp(nbt.getInt("drop_count"), 1, BTileEntity.MAX_DROP_COUNT); if(nbt.contains("drop_count")) te.drop_count_ = MathHelper.clamp(nbt.getInt("drop_count"), 1, DropperTileEntity.MAX_DROP_COUNT);
if(nbt.contains("drop_period")) te.drop_period_ = MathHelper.clamp(nbt.getInt("drop_period"), 0, 100); if(nbt.contains("drop_period")) te.drop_period_ = MathHelper.clamp(nbt.getInt("drop_period"), 0, 100);
if(nbt.contains("drop_logic")) te.drop_logic_ = nbt.getInt("drop_logic"); if(nbt.contains("drop_logic")) te.drop_logic_ = nbt.getInt("drop_logic");
if(nbt.contains("manual_rstrigger") && (nbt.getInt("manual_rstrigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; } if(nbt.contains("manual_rstrigger") && (nbt.getInt("manual_rstrigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; }
@ -793,11 +800,11 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class BGui extends ContainerScreen<BContainer> public static class DropperGui extends ContainerScreen<DropperContainer>
{ {
protected final PlayerEntity player_; protected final PlayerEntity player_;
public BGui(BContainer container, PlayerInventory player_inventory, ITextComponent title) public DropperGui(DropperContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -815,7 +822,7 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
{ {
BContainer container = (BContainer)getContainer(); DropperContainer container = (DropperContainer)getContainer();
int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5); int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5);
if((!isPointInRegion(114, 1, 61, 79, mouseX, mouseY))) { if((!isPointInRegion(114, 1, 61, 79, mouseX, mouseY))) {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
@ -838,7 +845,7 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
} else if(ndrop >= 34) { } else if(ndrop >= 34) {
ndrop = container.field(4) + 1; // + ndrop = container.field(4) + 1; // +
} else { } else {
ndrop = MathHelper.clamp(1+ndrop, 1, BTileEntity.MAX_DROP_COUNT); // slider ndrop = MathHelper.clamp(1+ndrop, 1, DropperTileEntity.MAX_DROP_COUNT); // slider
} }
container.onGuiAction("drop_count", ndrop); container.onGuiAction("drop_count", ndrop);
} else if(isPointInRegion(129, 50, 44, 10, mouseX, mouseY)) { } else if(isPointInRegion(129, 50, 44, 10, mouseX, mouseY)) {
@ -855,11 +862,11 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
} else if(isPointInRegion(114, 51, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(114, 51, 9, 9, mouseX, mouseY)) {
container.onGuiAction("manual_rstrigger", 1); container.onGuiAction("manual_rstrigger", 1);
} else if(isPointInRegion(162, 66, 7, 9, mouseX, mouseY)) { } else if(isPointInRegion(162, 66, 7, 9, mouseX, mouseY)) {
container.onGuiAction("drop_logic", container.field(5) ^ BTileEntity.DROPLOGIC_CONTINUOUS); container.onGuiAction("drop_logic", container.field(5) ^ DropperTileEntity.DROPLOGIC_CONTINUOUS);
} else if(isPointInRegion(132, 66, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(132, 66, 9, 9, mouseX, mouseY)) {
container.onGuiAction("drop_logic", container.field(5) ^ BTileEntity.DROPLOGIC_FILTER_ANDGATE); container.onGuiAction("drop_logic", container.field(5) ^ DropperTileEntity.DROPLOGIC_FILTER_ANDGATE);
} else if(isPointInRegion(148, 66, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(148, 66, 9, 9, mouseX, mouseY)) {
container.onGuiAction("drop_logic", container.field(5) ^ BTileEntity.DROPLOGIC_EXTERN_ANDGATE); container.onGuiAction("drop_logic", container.field(5) ^ DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE);
} }
return true; return true;
} }
@ -871,7 +878,7 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_dropper_gui.png")); this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_dropper_gui.png"));
final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize(); final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize();
blit(x0, y0, 0, 0, w, h); blit(x0, y0, 0, 0, w, h);
BContainer container = (BContainer)getContainer(); DropperContainer container = (DropperContainer)getContainer();
// active drop slot // active drop slot
{ {
int drop_slot_index = container.field(15); int drop_slot_index = container.field(15);
@ -922,16 +929,16 @@ public class BlockDecorDropper extends StandardBlocks.Directed implements IDecor
} }
// trigger logic // trigger logic
{ {
int filter_gate_offset = ((container.field(5) & BTileEntity.DROPLOGIC_FILTER_ANDGATE) != 0) ? 11 : 0; int filter_gate_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_FILTER_ANDGATE) != 0) ? 11 : 0;
int extern_gate_offset = ((container.field(5) & BTileEntity.DROPLOGIC_EXTERN_ANDGATE) != 0) ? 11 : 0; int extern_gate_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE) != 0) ? 11 : 0;
int pulse_mode_offset = ((container.field(5) & BTileEntity.DROPLOGIC_CONTINUOUS ) != 0) ? 10 : 0; int pulse_mode_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_CONTINUOUS ) != 0) ? 10 : 0;
blit(x0+132, y0+66, 179+filter_gate_offset, 66, 9, 9); blit(x0+132, y0+66, 179+filter_gate_offset, 66, 9, 9);
blit(x0+148, y0+66, 179+extern_gate_offset, 66, 9, 9); blit(x0+148, y0+66, 179+extern_gate_offset, 66, 9, 9);
blit(x0+162, y0+66, 200+pulse_mode_offset, 66, 9, 9); blit(x0+162, y0+66, 200+pulse_mode_offset, 66, 9, 9);
} }
// drop timer running indicator // drop timer running indicator
{ {
if((container.field(9) > BTileEntity.DROP_PERIOD_OFFSET) && ((System.currentTimeMillis() % 1000) < 500)) { if((container.field(9) > DropperTileEntity.DROP_PERIOD_OFFSET) && ((System.currentTimeMillis() % 1000) < 500)) {
blit(x0+149, y0+51, 201, 39, 3, 3); blit(x0+149, y0+51, 201, 39, 3, 3);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFurnaceElectrical.java * @file EdElectricalFurnace.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -10,8 +10,6 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.BlockDecorFurnace.DecorFurnaceBlock;
import wile.engineersdecor.blocks.BlockDecorFurnace.DecorFurnaceContainer;
import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.libmc.detail.Inventories;
import wile.engineersdecor.libmc.detail.Networking; import wile.engineersdecor.libmc.detail.Networking;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
@ -61,28 +59,28 @@ import java.util.Arrays;
import java.util.Random; import java.util.Random;
public class BlockDecorFurnaceElectrical public class EdElectricalFurnace
{ {
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceElectricalBlock extends DecorFurnaceBlock implements IDecorBlock public static class ElectricalFurnaceBlock extends EdFurnace.FurnaceBlock implements IDecorBlock
{ {
public DecorFurnaceElectricalBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) public ElectricalFurnaceBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
{ super(config, builder, unrotatedAABBs); } { super(config, builder, unrotatedAABBs); }
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorFurnaceElectrical.DecorFurnaceElectrical(); } { return new ElectricalFurnaceTileEntity(); }
@Override @Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return true; if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorFurnaceElectrical.DecorFurnaceElectrical)) return true; if(!(te instanceof ElectricalFurnaceTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
player.addStat(Stats.INTERACT_WITH_FURNACE); player.addStat(Stats.INTERACT_WITH_FURNACE);
@ -98,8 +96,8 @@ public class BlockDecorFurnaceElectrical
CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory"); CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory");
if(inventory_nbt.isEmpty()) return; if(inventory_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorFurnaceElectrical.DecorFurnaceElectrical)) return; if(!(te instanceof ElectricalFurnaceTileEntity)) return;
DecorFurnaceElectrical bte = (BlockDecorFurnaceElectrical.DecorFurnaceElectrical)te; ElectricalFurnaceTileEntity bte = (ElectricalFurnaceTileEntity)te;
bte.readnbt(inventory_nbt); bte.readnbt(inventory_nbt);
bte.markDirty(); bte.markDirty();
world.setBlockState(pos, state.with(LIT, bte.burning())); world.setBlockState(pos, state.with(LIT, bte.burning()));
@ -115,7 +113,7 @@ public class BlockDecorFurnaceElectrical
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceElectrical extends BlockDecorFurnace.DecorFurnaceTileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage public static class ElectricalFurnaceTileEntity extends EdFurnace.FurnaceTileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage
{ {
public static final IRecipeType<FurnaceRecipe> RECIPE_TYPE = IRecipeType.SMELTING; public static final IRecipeType<FurnaceRecipe> RECIPE_TYPE = IRecipeType.SMELTING;
public static final int NUM_OF_FIELDS = 7; public static final int NUM_OF_FIELDS = 7;
@ -168,10 +166,10 @@ public class BlockDecorFurnaceElectrical
private int fifo_timer_ = 0; private int fifo_timer_ = 0;
private boolean enabled_ = false; private boolean enabled_ = false;
public DecorFurnaceElectrical() public ElectricalFurnaceTileEntity()
{ this(ModContent.TET_SMALL_ELECTRICAL_FURNACE); } { this(ModContent.TET_SMALL_ELECTRICAL_FURNACE); }
public DecorFurnaceElectrical(TileEntityType<?> te_type) public ElectricalFurnaceTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void reset() public void reset()
@ -249,7 +247,7 @@ public class BlockDecorFurnaceElectrical
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BlockDecorFurnaceElectrical.DecorFurnaceElectricalContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new ElectricalFurnaceContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------ // IInventory ------------------------------------------------------------------------------
@ -272,19 +270,19 @@ public class BlockDecorFurnaceElectrical
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(DecorFurnaceElectrical.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(ElectricalFurnaceTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
{ {
switch(id) { switch(id) {
case 0: return DecorFurnaceElectrical.this.burntime_left_; case 0: return ElectricalFurnaceTileEntity.this.burntime_left_;
case 1: return DecorFurnaceElectrical.this.energy_stored_; case 1: return ElectricalFurnaceTileEntity.this.energy_stored_;
case 2: return DecorFurnaceElectrical.this.proc_time_elapsed_; case 2: return ElectricalFurnaceTileEntity.this.proc_time_elapsed_;
case 3: return DecorFurnaceElectrical.this.proc_time_needed_; case 3: return ElectricalFurnaceTileEntity.this.proc_time_needed_;
case 4: return DecorFurnaceElectrical.this.speed_; case 4: return ElectricalFurnaceTileEntity.this.speed_;
case 5: return DecorFurnaceElectrical.this.field_max_energy_stored_; case 5: return ElectricalFurnaceTileEntity.this.field_max_energy_stored_;
case 6: return DecorFurnaceElectrical.this.field_isburning_; case 6: return ElectricalFurnaceTileEntity.this.field_isburning_;
default: return 0; default: return 0;
} }
} }
@ -292,13 +290,13 @@ public class BlockDecorFurnaceElectrical
public void set(int id, int value) public void set(int id, int value)
{ {
switch(id) { switch(id) {
case 0: DecorFurnaceElectrical.this.burntime_left_ = value; break; case 0: ElectricalFurnaceTileEntity.this.burntime_left_ = value; break;
case 1: DecorFurnaceElectrical.this.energy_stored_ = value; break; case 1: ElectricalFurnaceTileEntity.this.energy_stored_ = value; break;
case 2: DecorFurnaceElectrical.this.proc_time_elapsed_ = value; break; case 2: ElectricalFurnaceTileEntity.this.proc_time_elapsed_ = value; break;
case 3: DecorFurnaceElectrical.this.proc_time_needed_ = value; break; case 3: ElectricalFurnaceTileEntity.this.proc_time_needed_ = value; break;
case 4: DecorFurnaceElectrical.this.speed_ = value; break; case 4: ElectricalFurnaceTileEntity.this.speed_ = value; break;
case 5: DecorFurnaceElectrical.this.field_max_energy_stored_ = value; break; case 5: ElectricalFurnaceTileEntity.this.field_max_energy_stored_ = value; break;
case 6: DecorFurnaceElectrical.this.field_isburning_ = value; break; case 6: ElectricalFurnaceTileEntity.this.field_isburning_ = value; break;
} }
} }
}; };
@ -358,9 +356,9 @@ public class BlockDecorFurnaceElectrical
protected static class BItemHandler implements IItemHandler protected static class BItemHandler implements IItemHandler
{ {
private DecorFurnaceElectrical te; private ElectricalFurnaceTileEntity te;
BItemHandler(DecorFurnaceElectrical te) BItemHandler(ElectricalFurnaceTileEntity te)
{ this.te = te; } { this.te = te; }
@Override @Override
@ -584,8 +582,8 @@ public class BlockDecorFurnaceElectrical
boolean dirty = false; boolean dirty = false;
if(energy_stored_ < transfer_energy_consumption_) return false; if(energy_stored_ < transfer_energy_consumption_) return false;
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(!(state.getBlock() instanceof DecorFurnaceElectricalBlock)) return false; if(!(state.getBlock() instanceof ElectricalFurnaceBlock)) return false;
final Direction out_facing = state.get(DecorFurnaceElectricalBlock.HORIZONTAL_FACING); final Direction out_facing = state.get(ElectricalFurnaceBlock.HORIZONTAL_FACING);
if(out && (!stacks_.get(FIFO_OUTPUT_1_SLOT_NO).isEmpty())) { if(out && (!stacks_.get(FIFO_OUTPUT_1_SLOT_NO).isEmpty())) {
TileEntity te = world.getTileEntity(pos.offset(out_facing)); TileEntity te = world.getTileEntity(pos.offset(out_facing));
if(te!=null) { if(te!=null) {
@ -599,7 +597,7 @@ public class BlockDecorFurnaceElectrical
} }
} }
if(with_automatic_inventory_pulling_ || is_accepted_hopper(stacks_.get(SMELTING_AUX_SLOT_NO))) { if(with_automatic_inventory_pulling_ || is_accepted_hopper(stacks_.get(SMELTING_AUX_SLOT_NO))) {
final Direction inp_facing = state.get(DecorFurnaceElectricalBlock.HORIZONTAL_FACING).getOpposite(); final Direction inp_facing = state.get(ElectricalFurnaceBlock.HORIZONTAL_FACING).getOpposite();
if(inp && (stacks_.get(FIFO_INPUT_1_SLOT_NO).isEmpty())) { if(inp && (stacks_.get(FIFO_INPUT_1_SLOT_NO).isEmpty())) {
TileEntity te = world.getTileEntity(pos.offset(inp_facing)); TileEntity te = world.getTileEntity(pos.offset(inp_facing));
if(te!=null) { if(te!=null) {
@ -648,18 +646,18 @@ public class BlockDecorFurnaceElectrical
private void sync_blockstate() private void sync_blockstate()
{ {
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if((state.getBlock() instanceof DecorFurnaceElectricalBlock) && (state.get(DecorFurnaceElectricalBlock.LIT) != burning())) { if((state.getBlock() instanceof ElectricalFurnaceBlock) && (state.get(ElectricalFurnaceBlock.LIT) != burning())) {
world.setBlockState(pos, state.with(DecorFurnaceElectricalBlock.LIT, burning()), 2); world.setBlockState(pos, state.with(ElectricalFurnaceBlock.LIT, burning()), 2);
} }
} }
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceElectricalContainer extends Container implements Networking.INetworkSynchronisableContainer public static class ElectricalFurnaceContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
private static final int PLAYER_INV_START_SLOTNO = 7; private static final int PLAYER_INV_START_SLOTNO = 7;
protected final PlayerEntity player_; protected final PlayerEntity player_;
@ -673,24 +671,24 @@ public class BlockDecorFurnaceElectrical
public IInventory inventory() { return inventory_ ; } public IInventory inventory() { return inventory_ ; }
public World world() { return player_.world; } public World world() { return player_.world; }
public DecorFurnaceElectricalContainer(int cid, PlayerInventory player_inventory) public ElectricalFurnaceContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(DecorFurnaceElectrical.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(DecorFurnaceElectrical.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(ElectricalFurnaceTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(ElectricalFurnaceTileEntity.NUM_OF_FIELDS)); }
private DecorFurnaceElectricalContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private ElectricalFurnaceContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_SMALL_ELECTRICAL_FURNACE, cid); super(ModContent.CT_SMALL_ELECTRICAL_FURNACE, cid);
player_ = player_inventory.player; player_ = player_inventory.player;
inventory_ = block_inventory; inventory_ = block_inventory;
wpc_ = wpc; wpc_ = wpc;
fields_ = fields; fields_ = fields;
recipe_type_ = DecorFurnaceElectrical.RECIPE_TYPE; recipe_type_ = ElectricalFurnaceTileEntity.RECIPE_TYPE;
addSlot(new Slot(inventory_, 0, 59, 28)); // smelting input addSlot(new Slot(inventory_, 0, 59, 28)); // smelting input
addSlot(new Slot(inventory_, 1, 16, 52)); // aux addSlot(new Slot(inventory_, 1, 16, 52)); // aux
addSlot(new DecorFurnaceContainer.BSlotResult(player_, inventory_, 2, 101, 28)); // smelting result addSlot(new EdFurnace.FurnaceContainer.BSlotResult(player_, inventory_, 2, 101, 28)); // smelting result
addSlot(new DecorFurnaceContainer.BSlotInpFifo(inventory_, 3, 34, 28)); // input fifo 0 addSlot(new EdFurnace.FurnaceContainer.BSlotInpFifo(inventory_, 3, 34, 28)); // input fifo 0
addSlot(new DecorFurnaceContainer.BSlotInpFifo(inventory_, 4, 16, 28)); // input fifo 1 addSlot(new EdFurnace.FurnaceContainer.BSlotInpFifo(inventory_, 4, 16, 28)); // input fifo 1
addSlot(new DecorFurnaceContainer.BSlotOutFifo(player_, inventory_, 5, 126, 28)); // out fifo 0 addSlot(new EdFurnace.FurnaceContainer.BSlotOutFifo(player_, inventory_, 5, 126, 28)); // out fifo 0
addSlot(new DecorFurnaceContainer.BSlotOutFifo(player_, inventory_, 6, 144, 28)); // out fifo 1 addSlot(new EdFurnace.FurnaceContainer.BSlotOutFifo(player_, inventory_, 6, 144, 28)); // out fifo 1
for(int x=0; x<9; ++x) { for(int x=0; x<9; ++x) {
addSlot(new Slot(player_inventory, x, 8+x*18, 144)); // player slots: 0..8 addSlot(new Slot(player_inventory, x, 8+x*18, 144)); // player slots: 0..8
} }
@ -725,7 +723,7 @@ public class BlockDecorFurnaceElectrical
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player inventory // Player inventory
if(DecorFurnaceElectrical.canSmelt(world(), slot_stack)) { if(ElectricalFurnaceTileEntity.canSmelt(world(), slot_stack)) {
if( if(
(!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input (!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input
(!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0 (!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0
@ -769,8 +767,8 @@ public class BlockDecorFurnaceElectrical
@Override @Override
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
{ {
if(!(inventory_ instanceof DecorFurnaceElectrical)) return; if(!(inventory_ instanceof ElectricalFurnaceTileEntity)) return;
DecorFurnaceElectrical te = (DecorFurnaceElectrical)inventory_; ElectricalFurnaceTileEntity te = (ElectricalFurnaceTileEntity)inventory_;
if(nbt.contains("speed")) te.speed_ = MathHelper.clamp(nbt.getInt("speed"), 0, 3); if(nbt.contains("speed")) te.speed_ = MathHelper.clamp(nbt.getInt("speed"), 0, 3);
te.markDirty(); te.markDirty();
} }
@ -781,11 +779,11 @@ public class BlockDecorFurnaceElectrical
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class DecorFurnaceElectricalGui extends ContainerScreen<DecorFurnaceElectricalContainer> public static class ElectricalFurnaceGui extends ContainerScreen<ElectricalFurnaceContainer>
{ {
protected final PlayerEntity player_; protected final PlayerEntity player_;
public DecorFurnaceElectricalGui(DecorFurnaceElectricalContainer container, PlayerInventory player_inventory, ITextComponent title) public ElectricalFurnaceGui(ElectricalFurnaceContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -827,7 +825,7 @@ public class BlockDecorFurnaceElectrical
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
{ {
DecorFurnaceElectricalContainer container = (DecorFurnaceElectricalContainer)getContainer(); ElectricalFurnaceContainer container = (ElectricalFurnaceContainer)getContainer();
int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5); int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5);
if((!isPointInRegion(136, 48, 28, 28, mouseX, mouseY))) { if((!isPointInRegion(136, 48, 28, 28, mouseX, mouseY))) {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
@ -848,7 +846,7 @@ public class BlockDecorFurnaceElectrical
private int heat_px(int pixels) private int heat_px(int pixels)
{ {
int k = ((getContainer().field(0) * (pixels+1)) / (BlockDecorFurnaceElectrical.DecorFurnaceElectrical.HEAT_CAPACITY)); int k = ((getContainer().field(0) * (pixels+1)) / (ElectricalFurnaceTileEntity.HEAT_CAPACITY));
return (k < pixels) ? k : pixels; return (k < pixels) ? k : pixels;
} }
@ -861,5 +859,4 @@ public class BlockDecorFurnaceElectrical
return k; return k;
} }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorWall.java * @file EdFenceBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -8,22 +8,21 @@
*/ */
package wile.engineersdecor.blocks; package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.StandardFenceBlock;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import wile.engineersdecor.libmc.blocks.StandardFenceBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
public class EdFenceBlock extends StandardFenceBlock implements IDecorBlock
public class BlockDecorFence extends StandardFenceBlock implements IDecorBlock
{ {
public BlockDecorFence(long config, Block.Properties properties) public EdFenceBlock(long config, Block.Properties properties)
{ super(config, properties); } { super(config, properties); }
public BlockDecorFence(long config, Block.Properties properties, double pole_width, double pole_height, double side_width, double side_max_y, double side_min_y) public EdFenceBlock(long config, Block.Properties properties, double pole_width, double pole_height, double side_width, double side_max_y, double side_min_y)
{ super(config, properties, pole_width, pole_height, side_width, side_max_y, side_min_y); } { super(config, properties, pole_width, pole_height, side_width, side_max_y, side_min_y); }
@Override @Override
protected boolean attachesTo(BlockState facingState, IWorldReader world, BlockPos facingPos, Direction side) protected boolean attachesTo(BlockState facingState, IWorldReader world, BlockPos facingPos, Direction side)
{ return ((facingState.getBlock()) instanceof BlockDecorDoubleGate) || super.attachesTo(facingState, world, facingPos, side); } { return ((facingState.getBlock()) instanceof EdDoubleGateBlock) || super.attachesTo(facingState, world, facingPos, side); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFloorGrating.java * @file EdFloorGratingBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -21,9 +21,9 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockDecorFloorGrating extends StandardBlocks.WaterLoggable implements IDecorBlock public class EdFloorGratingBlock extends StandardBlocks.WaterLoggable implements IDecorBlock
{ {
public BlockDecorFloorGrating(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdFloorGratingBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorPassiveFluidAccumulator.java * @file EdFluidAccumulator.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -41,44 +41,51 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorPassiveFluidAccumulator extends StandardBlocks.Directed implements IDecorBlock public class EdFluidAccumulator
{ {
public BlockDecorPassiveFluidAccumulator(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) //--------------------------------------------------------------------------------------------------------------------
{ super(config, builder, unrotatedAABB); } // Block
//--------------------------------------------------------------------------------------------------------------------
@Override public static class FluidAccumulatorBlock extends StandardBlocks.Directed implements IDecorBlock
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorPassiveFluidAccumulator.BTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return true; public FluidAccumulatorBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
TileEntity te = world.getTileEntity(pos); { super(config, builder, unrotatedAABB); }
if(!(te instanceof BTileEntity)) return true;
((BTileEntity)te).send_device_stats(player);
return true;
}
@Override @Override
@SuppressWarnings("deprecation") public boolean hasTileEntity(BlockState state)
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) { return true; }
{
TileEntity te = world.getTileEntity(pos); @Override
if(te instanceof BTileEntity) ((BTileEntity)te).block_changed(); @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new FluidAccumulatorTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return true;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidAccumulatorTileEntity)) return true;
((FluidAccumulatorTileEntity)te).send_device_stats(player);
return true;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof FluidAccumulatorTileEntity) ((FluidAccumulatorTileEntity)te).block_changed();
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider public static class FluidAccumulatorTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider
{ {
protected static int tick_idle_interval = 20; // ca 1000ms, simulates suction delay and saves CPU when not drained. protected static int tick_idle_interval = 20; // ca 1000ms, simulates suction delay and saves CPU when not drained.
protected static int max_flowrate = 1000; protected static int max_flowrate = 1000;
@ -103,10 +110,10 @@ public class BlockDecorPassiveFluidAccumulator extends StandardBlocks.Directed i
// TileEntity ------------------------------------------------------------------------------ // TileEntity ------------------------------------------------------------------------------
public BTileEntity() public FluidAccumulatorTileEntity()
{ this(ModContent.TET_PASSIVE_FLUID_ACCUMULATOR); } { this(ModContent.TET_PASSIVE_FLUID_ACCUMULATOR); }
public BTileEntity(TileEntityType<?> te_type) public FluidAccumulatorTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
@Override @Override
@ -136,8 +143,8 @@ public class BlockDecorPassiveFluidAccumulator extends StandardBlocks.Directed i
private static class InputFillHandler implements IFluidHandler private static class InputFillHandler implements IFluidHandler
{ {
private final BTileEntity parent_; private final FluidAccumulatorTileEntity parent_;
InputFillHandler(BTileEntity parent) { parent_ = parent; } InputFillHandler(FluidAccumulatorTileEntity parent) { parent_ = parent; }
@Override public int getTanks() { return 0; } @Override public int getTanks() { return 0; }
@Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; } @Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; }
@Override public int getTankCapacity(int tank) { return max_flowrate; } @Override public int getTankCapacity(int tank) { return max_flowrate; }
@ -151,8 +158,8 @@ public class BlockDecorPassiveFluidAccumulator extends StandardBlocks.Directed i
private static class OutputFlowHandler implements IFluidHandler private static class OutputFlowHandler implements IFluidHandler
{ {
private final BTileEntity te; private final FluidAccumulatorTileEntity te;
OutputFlowHandler(BTileEntity parent) { te = parent; } OutputFlowHandler(FluidAccumulatorTileEntity parent) { te = parent; }
@Override public int getTanks() { return 1; } @Override public int getTanks() { return 1; }
@Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); } @Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); }
@Override public int getTankCapacity(int tank) { return max_flowrate; } @Override public int getTankCapacity(int tank) { return max_flowrate; }
@ -208,8 +215,8 @@ public class BlockDecorPassiveFluidAccumulator extends StandardBlocks.Directed i
if(!initialized_) { if(!initialized_) {
initialized_ = true; initialized_ = true;
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if((state==null) || (!(state.getBlock() instanceof BlockDecorPassiveFluidAccumulator))) return; if((state==null) || (!(state.getBlock() instanceof FluidAccumulatorBlock))) return;
block_facing_ = state.get(FACING); block_facing_ = state.get(FluidAccumulatorBlock.FACING);
} }
int n_requested = last_drain_request_amount_; int n_requested = last_drain_request_amount_;
last_drain_request_amount_ = 0; last_drain_request_amount_ = 0;
@ -237,7 +244,7 @@ public class BlockDecorPassiveFluidAccumulator extends StandardBlocks.Directed i
final Direction f = Direction.byIndex(round_robin_); final Direction f = Direction.byIndex(round_robin_);
if(f == block_facing_) continue; if(f == block_facing_) continue;
final TileEntity te = world.getTileEntity(pos.offset(f)); final TileEntity te = world.getTileEntity(pos.offset(f));
if((te==null) || (te instanceof BTileEntity)) continue; if((te==null) || (te instanceof FluidAccumulatorTileEntity)) continue;
final IFluidHandler fh = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, f.getOpposite()).orElse(null); final IFluidHandler fh = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, f.getOpposite()).orElse(null);
if(fh==null) continue; if(fh==null) continue;
if(tank_.isEmpty()) { if(tank_.isEmpty()) {

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFluidFunnel.java * @file EdFluidFunnel.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -42,103 +42,111 @@ import javax.annotation.Nullable;
import java.util.*; import java.util.*;
public class BlockDecorFluidFunnel extends StandardBlocks.BaseBlock implements IDecorBlock public class EdFluidFunnel
{ {
public static final int FILL_LEVEL_MAX = 3; //--------------------------------------------------------------------------------------------------------------------
public static final IntegerProperty FILL_LEVEL = IntegerProperty.create("level", 0, FILL_LEVEL_MAX); // Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorFluidFunnel(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) public static class FluidFunnelBlock extends StandardBlocks.BaseBlock implements IDecorBlock
{ super(config, builder, unrotatedAABB); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(FILL_LEVEL); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(FILL_LEVEL, 0); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos)
{ return MathHelper.clamp((state.get(FILL_LEVEL)*5), 0, 15); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{ {
if(world.isRemote) return; public static final int FILL_LEVEL_MAX = 3;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return; public static final IntegerProperty FILL_LEVEL = IntegerProperty.create("level", 0, FILL_LEVEL_MAX);
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).readnbt(te_nbt);
((BTileEntity)te).markDirty();
world.setBlockState(pos, state.with(FILL_LEVEL, 0));
}
@Override public FluidFunnelBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
public boolean hasDynamicDropList() { super(config, builder, unrotatedAABB); }
{ return true; }
@Override @Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ { super.fillStateContainer(builder); builder.add(FILL_LEVEL); }
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; @Override
final TileEntity te = world.getTileEntity(pos); @Nullable
if(!(te instanceof BTileEntity)) return stacks; public BlockState getStateForPlacement(BlockItemUseContext context)
if(!explosion) { { return super.getStateForPlacement(context).with(FILL_LEVEL, 0); }
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = new CompoundNBT(); @Override
((BTileEntity)te).writenbt(te_nbt); public boolean hasTileEntity(BlockState state)
if(!te_nbt.isEmpty()) { { return true; }
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt); @Override
stack.setTag(nbt); @Nullable
} public TileEntity createTileEntity(BlockState state, IBlockReader world)
stacks.add(stack); { return new FluidFunnelTileEntity(); }
} else {
stacks.add(new ItemStack(this, 1)); @Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos)
{ return MathHelper.clamp((state.get(FILL_LEVEL)*5), 0, 15); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidFunnelTileEntity)) return;
((FluidFunnelTileEntity)te).readnbt(te_nbt);
((FluidFunnelTileEntity)te).markDirty();
world.setBlockState(pos, state.with(FILL_LEVEL, 0));
} }
return stacks;
}
@Override @Override
@SuppressWarnings("deprecation") public boolean hasDynamicDropList()
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { return true; }
{
if(world.isRemote) return true;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return false;
return FluidUtil.interactWithFluidHandler(player, hand, world, pos, rayTraceResult.getFace());
}
@Override @Override
@SuppressWarnings("deprecation") public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) {
{ TileEntity te = world.getTileEntity(pos); if(te instanceof BTileEntity) ((BTileEntity)te).block_changed(); } final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidFunnelTileEntity)) return stacks;
if(!explosion) {
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = new CompoundNBT();
((FluidFunnelTileEntity)te).writenbt(te_nbt);
if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt);
stack.setTag(nbt);
}
stacks.add(stack);
} else {
stacks.add(new ItemStack(this, 1));
}
return stacks;
}
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return true;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidFunnelTileEntity)) return false;
return FluidUtil.interactWithFluidHandler(player, hand, world, pos, rayTraceResult.getFace());
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{ TileEntity te = world.getTileEntity(pos); if(te instanceof FluidFunnelTileEntity) ((FluidFunnelTileEntity)te).block_changed(); }
}
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider, IFluidTank public static class FluidFunnelTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider, IFluidTank
{ {
public static final int TANK_CAPACITY = 3000; public static final int TANK_CAPACITY = 3000;
public static final int TICK_INTERVAL = 10; // ca 500ms public static final int TICK_INTERVAL = 10; // ca 500ms
@ -160,10 +168,10 @@ public class BlockDecorFluidFunnel extends StandardBlocks.BaseBlock implements I
public void block_changed() public void block_changed()
{ tick_timer_ = TICK_INTERVAL; } // collect after flowing fluid has a stable state, otherwise it looks odd. { tick_timer_ = TICK_INTERVAL; } // collect after flowing fluid has a stable state, otherwise it looks odd.
public BTileEntity() public FluidFunnelTileEntity()
{ this(ModContent.TET_SMALL_FLUID_FUNNEL); } { this(ModContent.TET_SMALL_FLUID_FUNNEL); }
public BTileEntity(TileEntityType<?> te_type) public FluidFunnelTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void readnbt(CompoundNBT nbt) public void readnbt(CompoundNBT nbt)
@ -197,8 +205,8 @@ public class BlockDecorFluidFunnel extends StandardBlocks.BaseBlock implements I
private static class OutputFluidHandler implements IFluidHandler private static class OutputFluidHandler implements IFluidHandler
{ {
private final BTileEntity te; private final FluidFunnelTileEntity te;
OutputFluidHandler(BTileEntity parent) { te = parent; } OutputFluidHandler(FluidFunnelTileEntity parent) { te = parent; }
@Override public int getTanks() { return 1; } @Override public int getTanks() { return 1; }
@Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); } @Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); }
@Override public int getTankCapacity(int tank) { return TANK_CAPACITY; } @Override public int getTankCapacity(int tank) { return TANK_CAPACITY; }
@ -419,9 +427,9 @@ public class BlockDecorFluidFunnel extends StandardBlocks.BaseBlock implements I
} }
} }
// Block state // Block state
int fill_level = (tank_==null) ? 0 : (MathHelper.clamp(tank_.getAmount()/1000,0,FILL_LEVEL_MAX)); int fill_level = (tank_==null) ? 0 : (MathHelper.clamp(tank_.getAmount()/1000,0, FluidFunnelBlock.FILL_LEVEL_MAX));
final BlockState funnel_state = world.getBlockState(pos); final BlockState funnel_state = world.getBlockState(pos);
if(funnel_state.get(FILL_LEVEL) != fill_level) world.setBlockState(pos, funnel_state.with(FILL_LEVEL, fill_level), 2|16); if(funnel_state.get(FluidFunnelBlock.FILL_LEVEL) != fill_level) world.setBlockState(pos, funnel_state.with(FluidFunnelBlock.FILL_LEVEL, fill_level), 2|16);
if(dirty) markDirty(); if(dirty) markDirty();
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockFurnace.java * @file EdFurnace.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -10,7 +10,7 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ExtItems; import wile.engineersdecor.detail.ExternalObjects;
import wile.engineersdecor.libmc.blocks.StandardBlocks; import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.libmc.detail.Inventories;
import wile.engineersdecor.libmc.detail.Networking; import wile.engineersdecor.libmc.detail.Networking;
@ -64,17 +64,17 @@ import javax.annotation.Nullable;
import java.util.*; import java.util.*;
public class BlockDecorFurnace public class EdFurnace
{ {
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceBlock extends StandardBlocks.Horizontal implements IDecorBlock public static class FurnaceBlock extends StandardBlocks.Horizontal implements IDecorBlock
{ {
public static final BooleanProperty LIT = RedstoneTorchBlock.LIT; public static final BooleanProperty LIT = RedstoneTorchBlock.LIT;
public DecorFurnaceBlock(long config, Block.Properties properties, final AxisAlignedBB[] unrotatedAABB) public FurnaceBlock(long config, Block.Properties properties, final AxisAlignedBB[] unrotatedAABB)
{ super(config, properties, unrotatedAABB); setDefaultState(super.getDefaultState().with(LIT, false)); } { super(config, properties, unrotatedAABB); setDefaultState(super.getDefaultState().with(LIT, false)); }
@Override @Override
@ -101,7 +101,7 @@ public class BlockDecorFurnace
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos) public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ {
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
return (te instanceof DecorFurnaceTileEntity) ? ((DecorFurnaceTileEntity)te).getComparatorOutput() : 0; return (te instanceof FurnaceTileEntity) ? ((FurnaceTileEntity)te).getComparatorOutput() : 0;
} }
@Override @Override
@ -111,7 +111,7 @@ public class BlockDecorFurnace
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorFurnace.DecorFurnaceTileEntity(); } { return new FurnaceTileEntity(); }
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
@ -122,8 +122,8 @@ public class BlockDecorFurnace
CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory"); CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory");
if(inventory_nbt.isEmpty()) return; if(inventory_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorFurnace.DecorFurnaceTileEntity)) return; if(!(te instanceof FurnaceTileEntity)) return;
final BlockDecorFurnace.DecorFurnaceTileEntity bte = ((BlockDecorFurnace.DecorFurnaceTileEntity)te); final FurnaceTileEntity bte = ((FurnaceTileEntity)te);
bte.readnbt(inventory_nbt); bte.readnbt(inventory_nbt);
bte.markDirty(); bte.markDirty();
world.setBlockState(pos, state.with(LIT, bte.burning())); world.setBlockState(pos, state.with(LIT, bte.burning()));
@ -138,10 +138,10 @@ public class BlockDecorFurnace
final List<ItemStack> stacks = new ArrayList<ItemStack>(); final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorFurnaceTileEntity)) return stacks; if(!(te instanceof FurnaceTileEntity)) return stacks;
if(!explosion) { if(!explosion) {
ItemStack stack = new ItemStack(this, 1); ItemStack stack = new ItemStack(this, 1);
CompoundNBT inventory_nbt = ((DecorFurnaceTileEntity)te).reset_getnbt(); CompoundNBT inventory_nbt = ((FurnaceTileEntity)te).reset_getnbt();
if(!inventory_nbt.isEmpty()) { if(!inventory_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.put("inventory", inventory_nbt); nbt.put("inventory", inventory_nbt);
@ -149,8 +149,8 @@ public class BlockDecorFurnace
} }
stacks.add(stack); stacks.add(stack);
} else { } else {
for(ItemStack stack: ((DecorFurnaceTileEntity)te).stacks_) stacks.add(stack); for(ItemStack stack: ((FurnaceTileEntity)te).stacks_) stacks.add(stack);
((DecorFurnaceTileEntity)te).reset(); ((FurnaceTileEntity)te).reset();
} }
return stacks; return stacks;
} }
@ -161,7 +161,7 @@ public class BlockDecorFurnace
{ {
if(world.isRemote) return true; if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorFurnace.DecorFurnaceTileEntity)) return true; if(!(te instanceof FurnaceTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
player.addStat(Stats.INTERACT_WITH_FURNACE); player.addStat(Stats.INTERACT_WITH_FURNACE);
@ -192,7 +192,7 @@ public class BlockDecorFurnace
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage public static class FurnaceTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage
{ {
public static final IRecipeType<FurnaceRecipe> RECIPE_TYPE = IRecipeType.SMELTING; public static final IRecipeType<FurnaceRecipe> RECIPE_TYPE = IRecipeType.SMELTING;
public static final int NUM_OF_FIELDS = 5; public static final int NUM_OF_FIELDS = 5;
@ -245,10 +245,10 @@ public class BlockDecorFurnace
protected @Nullable IRecipe current_recipe_ = null; protected @Nullable IRecipe current_recipe_ = null;
private final List<String> recent_recipes_ = new ArrayList<>(); private final List<String> recent_recipes_ = new ArrayList<>();
public DecorFurnaceTileEntity() public FurnaceTileEntity()
{ this(ModContent.TET_SMALL_LAB_FURNACE); } { this(ModContent.TET_SMALL_LAB_FURNACE); }
public DecorFurnaceTileEntity(TileEntityType<?> te_type) public FurnaceTileEntity(TileEntityType<?> te_type)
{ super(te_type); reset(); } { super(te_type); reset(); }
public CompoundNBT reset_getnbt() public CompoundNBT reset_getnbt()
@ -352,7 +352,7 @@ public class BlockDecorFurnace
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BlockDecorFurnace.DecorFurnaceContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new FurnaceContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------ // IInventory ------------------------------------------------------------------------------
@ -438,17 +438,17 @@ public class BlockDecorFurnace
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(DecorFurnaceTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(FurnaceTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
{ {
switch(id) { switch(id) {
case 0: return DecorFurnaceTileEntity.this.burntime_left_; case 0: return FurnaceTileEntity.this.burntime_left_;
case 1: return DecorFurnaceTileEntity.this.fuel_burntime_; case 1: return FurnaceTileEntity.this.fuel_burntime_;
case 2: return (int)DecorFurnaceTileEntity.this.field_proc_time_elapsed_; case 2: return (int)FurnaceTileEntity.this.field_proc_time_elapsed_;
case 3: return DecorFurnaceTileEntity.this.proc_time_needed_; case 3: return FurnaceTileEntity.this.proc_time_needed_;
case 4: return DecorFurnaceTileEntity.this.field_is_burning_; case 4: return FurnaceTileEntity.this.field_is_burning_;
default: return 0; default: return 0;
} }
} }
@ -456,11 +456,11 @@ public class BlockDecorFurnace
public void set(int id, int value) public void set(int id, int value)
{ {
switch(id) { switch(id) {
case 0: DecorFurnaceTileEntity.this.burntime_left_ = value; break; case 0: FurnaceTileEntity.this.burntime_left_ = value; break;
case 1: DecorFurnaceTileEntity.this.fuel_burntime_ = value; break; case 1: FurnaceTileEntity.this.fuel_burntime_ = value; break;
case 2: DecorFurnaceTileEntity.this.field_proc_time_elapsed_ = value; break; case 2: FurnaceTileEntity.this.field_proc_time_elapsed_ = value; break;
case 3: DecorFurnaceTileEntity.this.proc_time_needed_ = value; break; case 3: FurnaceTileEntity.this.proc_time_needed_ = value; break;
case 4: DecorFurnaceTileEntity.this.field_is_burning_ = value; case 4: FurnaceTileEntity.this.field_is_burning_ = value;
} }
} }
}; };
@ -561,9 +561,9 @@ public class BlockDecorFurnace
if(transferItems(FIFO_FUEL_1_SLOT_NO, FIFO_FUEL_0_SLOT_NO, 1)) dirty = true; if(transferItems(FIFO_FUEL_1_SLOT_NO, FIFO_FUEL_0_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_INPUT_0_SLOT_NO, SMELTING_INPUT_SLOT_NO, 1)) dirty = true; if(transferItems(FIFO_INPUT_0_SLOT_NO, SMELTING_INPUT_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_INPUT_1_SLOT_NO, FIFO_INPUT_0_SLOT_NO, 1)) dirty = true; if(transferItems(FIFO_INPUT_1_SLOT_NO, FIFO_INPUT_0_SLOT_NO, 1)) dirty = true;
heater_inserted_ = (ExtItems.IE_EXTERNAL_HEATER==null) // without IE always allow electrical boost heater_inserted_ = (ExternalObjects.IE_EXTERNAL_HEATER==null) // without IE always allow electrical boost
|| (stacks_.get(AUX_0_SLOT_NO).getItem()==ExtItems.IE_EXTERNAL_HEATER) || (stacks_.get(AUX_0_SLOT_NO).getItem()==ExternalObjects.IE_EXTERNAL_HEATER)
|| (stacks_.get(AUX_1_SLOT_NO).getItem()==ExtItems.IE_EXTERNAL_HEATER); || (stacks_.get(AUX_1_SLOT_NO).getItem()==ExternalObjects.IE_EXTERNAL_HEATER);
if(!burning()) cleanupRecentRecipes(); if(!burning()) cleanupRecentRecipes();
} }
ItemStack fuel = stacks_.get(SMELTING_FUEL_SLOT_NO); ItemStack fuel = stacks_.get(SMELTING_FUEL_SLOT_NO);
@ -604,8 +604,8 @@ public class BlockDecorFurnace
if(was_burning != burning()) { if(was_burning != burning()) {
dirty = true; dirty = true;
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof DecorFurnaceBlock) { if(state.getBlock() instanceof FurnaceBlock) {
world.setBlockState(pos, state.with(DecorFurnaceBlock.LIT, burning())); world.setBlockState(pos, state.with(FurnaceBlock.LIT, burning()));
} }
} }
if(dirty) { if(dirty) {
@ -757,7 +757,7 @@ public class BlockDecorFurnace
// container slots // container slots
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceContainer extends Container implements Networking.INetworkSynchronisableContainer public static class FurnaceContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
// Slots -------------------------------------------------------------------------------------------- // Slots --------------------------------------------------------------------------------------------
@ -808,8 +808,8 @@ public class BlockDecorFurnace
protected void onCrafting(ItemStack stack) protected void onCrafting(ItemStack stack)
{ {
stack.onCrafting(player_.world, player_, removeCount); stack.onCrafting(player_.world, player_, removeCount);
if((!player_.world.isRemote) && (inventory_ instanceof DecorFurnaceTileEntity)) { if((!player_.world.isRemote) && (inventory_ instanceof FurnaceTileEntity)) {
DecorFurnaceTileEntity te = (DecorFurnaceTileEntity)inventory_; FurnaceTileEntity te = (FurnaceTileEntity)inventory_;
int xp = removeCount; int xp = removeCount;
float sxp = te.getSmeltingExperience(stack); float sxp = te.getSmeltingExperience(stack);
if(sxp == 0) { if(sxp == 0) {
@ -830,14 +830,14 @@ public class BlockDecorFurnace
public static class BFuelSlot extends Slot public static class BFuelSlot extends Slot
{ {
private final DecorFurnaceContainer container_; private final FurnaceContainer container_;
public BFuelSlot(IInventory inventory, int index, int xpos, int ypos, DecorFurnaceContainer container) public BFuelSlot(IInventory inventory, int index, int xpos, int ypos, FurnaceContainer container)
{ super(inventory, index, xpos, ypos); container_=container; } { super(inventory, index, xpos, ypos); container_=container; }
@Override @Override
public boolean isItemValid(ItemStack stack) public boolean isItemValid(ItemStack stack)
{ return isBucket(stack) || (DecorFurnaceTileEntity.isFuel(container_.world(), stack)); } { return isBucket(stack) || (FurnaceTileEntity.isFuel(container_.world(), stack)); }
@Override @Override
public int getItemStackLimit(ItemStack stack) public int getItemStackLimit(ItemStack stack)
@ -861,17 +861,17 @@ public class BlockDecorFurnace
public IInventory inventory() { return inventory_ ; } public IInventory inventory() { return inventory_ ; }
public World world() { return player_.world; } public World world() { return player_.world; }
public DecorFurnaceContainer(int cid, PlayerInventory player_inventory) public FurnaceContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(DecorFurnaceTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(DecorFurnaceTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(FurnaceTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(FurnaceTileEntity.NUM_OF_FIELDS)); }
private DecorFurnaceContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private FurnaceContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_SMALL_LAB_FURNACE, cid); super(ModContent.CT_SMALL_LAB_FURNACE, cid);
player_ = player_inventory.player; player_ = player_inventory.player;
inventory_ = block_inventory; inventory_ = block_inventory;
wpc_ = wpc; wpc_ = wpc;
fields_ = fields; fields_ = fields;
recipe_type_ = DecorFurnaceTileEntity.RECIPE_TYPE; recipe_type_ = FurnaceTileEntity.RECIPE_TYPE;
addSlot(new Slot(inventory_, 0, 59, 17)); // smelting input addSlot(new Slot(inventory_, 0, 59, 17)); // smelting input
addSlot(new BFuelSlot(inventory_, 1, 59, 53, this)); // fuel addSlot(new BFuelSlot(inventory_, 1, 59, 53, this)); // fuel
addSlot(new BSlotResult(player_, inventory_, 2, 101, 35)); // smelting result addSlot(new BSlotResult(player_, inventory_, 2, 101, 35)); // smelting result
@ -919,13 +919,13 @@ public class BlockDecorFurnace
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player inventory // Player inventory
if(DecorFurnaceTileEntity.canSmelt(world(), slot_stack)) { if(FurnaceTileEntity.canSmelt(world(), slot_stack)) {
if( if(
(!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input (!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input
(!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0 (!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0
(!mergeItemStack(slot_stack, 4, 5, false)) // fifo1 (!mergeItemStack(slot_stack, 4, 5, false)) // fifo1
) return ItemStack.EMPTY; ) return ItemStack.EMPTY;
} else if(DecorFurnaceTileEntity.isFuel(player_.world, slot_stack)) { } else if(FurnaceTileEntity.isFuel(player_.world, slot_stack)) {
if( if(
(!mergeItemStack(slot_stack, 1, 2, false)) && // fuel input (!mergeItemStack(slot_stack, 1, 2, false)) && // fuel input
(!mergeItemStack(slot_stack, 5, 6, false)) && // fuel fifo0 (!mergeItemStack(slot_stack, 5, 6, false)) && // fuel fifo0
@ -982,11 +982,11 @@ public class BlockDecorFurnace
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class DecorFurnaceGui extends ContainerScreen<DecorFurnaceContainer> public static class FurnaceGui extends ContainerScreen<FurnaceContainer>
{ {
protected final PlayerEntity player_; protected final PlayerEntity player_;
public DecorFurnaceGui(DecorFurnaceContainer container, PlayerInventory player_inventory, ITextComponent title) public FurnaceGui(FurnaceContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -1019,7 +1019,7 @@ public class BlockDecorFurnace
{ final int tc=getContainer().field(2), T=getContainer().field(3); return ((T>0) && (tc>0)) ? (tc * pixels / T) : (0); } { final int tc=getContainer().field(2), T=getContainer().field(3); return ((T>0) && (tc>0)) ? (tc * pixels / T) : (0); }
private int flame_px(int pixels) private int flame_px(int pixels)
{ int ibt = getContainer().field(1); return ((getContainer().field(0) * pixels) / ((ibt>0) ? (ibt) : (DecorFurnaceTileEntity.STD_SMELTING_TIME))); } { int ibt = getContainer().field(1); return ((getContainer().field(0) * pixels) / ((ibt>0) ? (ibt) : (FurnaceTileEntity.STD_SMELTING_TIME))); }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFull.java * @file EdGlassBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -25,9 +25,9 @@ import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class BlockDecorGlassBlock extends StainedGlassBlock implements IDecorBlock public class EdGlassBlock extends StainedGlassBlock implements IDecorBlock
{ {
public BlockDecorGlassBlock(long config, Block.Properties properties) public EdGlassBlock(long config, Block.Properties properties)
{ super(DyeColor.BLACK, properties); } { super(DyeColor.BLACK, properties); }
@Override @Override

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorHopper.java * @file EdHopper.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -19,10 +19,8 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.HopperBlock;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.HopperTileEntity;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
@ -60,7 +58,7 @@ import java.util.List;
import java.util.function.Supplier; import java.util.function.Supplier;
public class BlockDecorHopper public class EdHopper
{ {
public static void on_config(int cooldown_ticks) public static void on_config(int cooldown_ticks)
{ {
@ -71,9 +69,9 @@ public class BlockDecorHopper
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorHopperBlock extends StandardBlocks.Directed implements IDecorBlock public static class HopperBlock extends StandardBlocks.Directed implements IDecorBlock
{ {
public DecorHopperBlock(long config, Block.Properties builder, final Supplier<ArrayList<VoxelShape>> shape_supplier) public HopperBlock(long config, Block.Properties builder, final Supplier<ArrayList<VoxelShape>> shape_supplier)
{ super(config, builder, shape_supplier); } { super(config, builder, shape_supplier); }
@Override @Override
@ -97,7 +95,7 @@ public class BlockDecorHopper
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new DecorHopperTileEntity(); } { return new HopperTileEntity(); }
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
@ -107,10 +105,10 @@ public class BlockDecorHopper
CompoundNBT te_nbt = stack.getTag().getCompound("tedata"); CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return; if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return; if(!(te instanceof HopperTileEntity)) return;
((DecorHopperTileEntity)te).readnbt(te_nbt, false); ((HopperTileEntity)te).readnbt(te_nbt, false);
((DecorHopperTileEntity)te).reset_rtstate(); ((HopperTileEntity)te).reset_rtstate();
((DecorHopperTileEntity)te).markDirty(); ((HopperTileEntity)te).markDirty();
} }
@Override @Override
@ -123,10 +121,10 @@ public class BlockDecorHopper
final List<ItemStack> stacks = new ArrayList<ItemStack>(); final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return stacks; if(!(te instanceof HopperTileEntity)) return stacks;
if(!explosion) { if(!explosion) {
ItemStack stack = new ItemStack(this, 1); ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((DecorHopperTileEntity)te).clear_getnbt(); CompoundNBT te_nbt = ((HopperTileEntity)te).clear_getnbt();
if(!te_nbt.isEmpty()) { if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt); nbt.put("tedata", te_nbt);
@ -134,10 +132,10 @@ public class BlockDecorHopper
} }
stacks.add(stack); stacks.add(stack);
} else { } else {
for(ItemStack stack: ((DecorHopperTileEntity)te).stacks_) { for(ItemStack stack: ((HopperTileEntity)te).stacks_) {
if(!stack.isEmpty()) stacks.add(stack); if(!stack.isEmpty()) stacks.add(stack);
} }
((DecorHopperTileEntity)te).reset_rtstate(); ((HopperTileEntity)te).reset_rtstate();
} }
return stacks; return stacks;
} }
@ -148,7 +146,7 @@ public class BlockDecorHopper
{ {
if(world.isRemote) return true; if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return true; if(!(te instanceof HopperTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return true; return true;
@ -160,8 +158,8 @@ public class BlockDecorHopper
{ {
if(!(world instanceof World) || (((World) world).isRemote)) return; if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return; if(!(te instanceof HopperTileEntity)) return;
((DecorHopperTileEntity)te).block_updated(); ((HopperTileEntity)te).block_updated();
} }
@Override @Override
@ -170,8 +168,8 @@ public class BlockDecorHopper
super.onFallenUpon(world, pos, entity, fallDistance); super.onFallenUpon(world, pos, entity, fallDistance);
if(!(entity instanceof ItemEntity)) return; if(!(entity instanceof ItemEntity)) return;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return; if(!(te instanceof HopperTileEntity)) return;
((DecorHopperTileEntity)te).collection_timer_ = 0; ((HopperTileEntity)te).collection_timer_ = 0;
} }
@Override @Override
@ -195,7 +193,7 @@ public class BlockDecorHopper
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorHopperTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory public static class HopperTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory
{ {
public static final int NUM_OF_FIELDS = 7; public static final int NUM_OF_FIELDS = 7;
public static final int TICK_INTERVAL = 10; public static final int TICK_INTERVAL = 10;
@ -220,14 +218,14 @@ public class BlockDecorHopper
private int tick_timer_ = 0; private int tick_timer_ = 0;
protected NonNullList<ItemStack> stacks_; protected NonNullList<ItemStack> stacks_;
public DecorHopperTileEntity() public HopperTileEntity()
{ {
this(ModContent.TET_FACTORY_HOPPER); this(ModContent.TET_FACTORY_HOPPER);
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
reset_rtstate(); reset_rtstate();
} }
public DecorHopperTileEntity(TileEntityType<?> te_type) public HopperTileEntity(TileEntityType<?> te_type)
{ {
super(te_type); super(te_type);
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
@ -328,7 +326,7 @@ public class BlockDecorHopper
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new DecorHopperContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new HopperContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory -------------------------------------------------------------------------------------------- // IInventory --------------------------------------------------------------------------------------------
@ -391,7 +389,7 @@ public class BlockDecorHopper
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(DecorHopperTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(HopperTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
@ -505,11 +503,11 @@ public class BlockDecorHopper
if(te == null) { delay_timer_ = TICK_INTERVAL+2; return false; } // no reason to recalculate this all the time if there is nothere to insert. if(te == null) { delay_timer_ = TICK_INTERVAL+2; return false; } // no reason to recalculate this all the time if there is nothere to insert.
final IItemHandler ih = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()).orElse(null); final IItemHandler ih = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()).orElse(null);
if(ih == null) { delay_timer_ = TICK_INTERVAL+2; return false; } if(ih == null) { delay_timer_ = TICK_INTERVAL+2; return false; }
if(te instanceof HopperTileEntity) { if(te instanceof net.minecraft.tileentity.HopperTileEntity) {
Direction f = world.getBlockState(pos.offset(facing)).get(HopperBlock.FACING); Direction f = world.getBlockState(pos.offset(facing)).get(net.minecraft.block.HopperBlock.FACING);
if(f==facing.getOpposite()) return false; // no back transfer if(f==facing.getOpposite()) return false; // no back transfer
} else if(te instanceof DecorHopperTileEntity) { } else if(te instanceof EdHopper.HopperTileEntity) {
Direction f = world.getBlockState(pos.offset(facing)).get(DecorHopperBlock.FACING); Direction f = world.getBlockState(pos.offset(facing)).get(EdHopper.HopperBlock.FACING);
if(f==facing.getOpposite()) return false; if(f==facing.getOpposite()) return false;
} }
ItemStack insert_stack = current_stack.copy(); ItemStack insert_stack = current_stack.copy();
@ -627,7 +625,7 @@ public class BlockDecorHopper
boolean trigger = (rssignal && ((block_power_updated_) || (!pulse_mode))); boolean trigger = (rssignal && ((block_power_updated_) || (!pulse_mode)));
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(state == null) { block_power_signal_= false; return; } if(state == null) { block_power_signal_= false; return; }
final Direction hopper_facing = state.get(DecorHopperBlock.FACING); final Direction hopper_facing = state.get(HopperBlock.FACING);
// Trigger edge detection for next cycle // Trigger edge detection for next cycle
{ {
boolean tr = world.isBlockPowered(pos); boolean tr = world.isBlockPowered(pos);
@ -664,17 +662,19 @@ public class BlockDecorHopper
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorHopperContainer extends Container implements Networking.INetworkSynchronisableContainer public static class HopperContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
private static final int PLAYER_INV_START_SLOTNO = DecorHopperTileEntity.NUM_OF_SLOTS; protected static final String QUICK_MOVE_ALL = "quick-move-all";
private static final int NUM_OF_CONTAINER_SLOTS = DecorHopperTileEntity.NUM_OF_SLOTS + 36;
private static final int PLAYER_INV_START_SLOTNO = HopperTileEntity.NUM_OF_SLOTS;
private static final int NUM_OF_CONTAINER_SLOTS = HopperTileEntity.NUM_OF_SLOTS + 36;
protected static final int STORAGE_SLOT_BEGIN = 0; protected static final int STORAGE_SLOT_BEGIN = 0;
protected static final int STORAGE_SLOT_END = DecorHopperTileEntity.NUM_OF_SLOTS; protected static final int STORAGE_SLOT_END = HopperTileEntity.NUM_OF_SLOTS;
protected static final int PLAYER_SLOT_BEGIN = DecorHopperTileEntity.NUM_OF_SLOTS; protected static final int PLAYER_SLOT_BEGIN = HopperTileEntity.NUM_OF_SLOTS;
protected static final int PLAYER_SLOT_END = DecorHopperTileEntity.NUM_OF_SLOTS+36; protected static final int PLAYER_SLOT_END = HopperTileEntity.NUM_OF_SLOTS+36;
private final SlotRange player_inventory_slot_range; private final SlotRange player_inventory_slot_range;
private final SlotRange hopper_slot_range; private final SlotRange hopper_slot_range;
private final PlayerEntity player_; private final PlayerEntity player_;
@ -684,17 +684,17 @@ public class BlockDecorHopper
public final int field(int index) { return fields_.get(index); } public final int field(int index) { return fields_.get(index); }
public DecorHopperContainer(int cid, PlayerInventory player_inventory) public HopperContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(DecorHopperTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(DecorHopperTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(HopperTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(HopperTileEntity.NUM_OF_FIELDS)); }
private DecorHopperContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private HopperContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_FACTORY_HOPPER, cid); super(ModContent.CT_FACTORY_HOPPER, cid);
fields_ = fields; fields_ = fields;
wpc_ = wpc; wpc_ = wpc;
player_ = player_inventory.player; player_ = player_inventory.player;
inventory_ = block_inventory; inventory_ = block_inventory;
hopper_slot_range = new SlotRange(inventory_, 0, DecorHopperTileEntity.NUM_OF_SLOTS); hopper_slot_range = new SlotRange(inventory_, 0, HopperTileEntity.NUM_OF_SLOTS);
player_inventory_slot_range = new SlotRange(player_inventory, 0, 36); player_inventory_slot_range = new SlotRange(player_inventory, 0, 36);
int i=-1; int i=-1;
@ -733,7 +733,7 @@ public class BlockDecorHopper
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player slot // Player slot
if(!mergeItemStack(slot_stack, 0, DecorHopperTileEntity.NUM_OF_SLOTS, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, 0, HopperTileEntity.NUM_OF_SLOTS, false)) return ItemStack.EMPTY;
} else { } else {
// invalid slot // invalid slot
return ItemStack.EMPTY; return ItemStack.EMPTY;
@ -776,18 +776,18 @@ public class BlockDecorHopper
@Override @Override
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
{ {
if(!(inventory_ instanceof DecorHopperTileEntity)) return; if(!(inventory_ instanceof HopperTileEntity)) return;
DecorHopperTileEntity te = (DecorHopperTileEntity)inventory_; HopperTileEntity te = (HopperTileEntity)inventory_;
if(nbt.contains("xsize")) te.transfer_count_ = MathHelper.clamp(nbt.getInt("xsize"), 1, DecorHopperTileEntity.MAX_TRANSFER_COUNT); if(nbt.contains("xsize")) te.transfer_count_ = MathHelper.clamp(nbt.getInt("xsize"), 1, HopperTileEntity.MAX_TRANSFER_COUNT);
if(nbt.contains("period")) te.transfer_period_ = MathHelper.clamp(nbt.getInt("period"), 0, 100); if(nbt.contains("period")) te.transfer_period_ = MathHelper.clamp(nbt.getInt("period"), 0, 100);
if(nbt.contains("range")) te.collection_range_ = MathHelper.clamp(nbt.getInt("range"), 0, DecorHopperTileEntity.MAX_COLLECTION_RANGE); if(nbt.contains("range")) te.collection_range_ = MathHelper.clamp(nbt.getInt("range"), 0, HopperTileEntity.MAX_COLLECTION_RANGE);
if(nbt.contains("logic")) te.logic_ = nbt.getInt("logic"); if(nbt.contains("logic")) te.logic_ = nbt.getInt("logic");
if(nbt.contains("manual_trigger") && (nbt.getInt("manual_trigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; } if(nbt.contains("manual_trigger") && (nbt.getInt("manual_trigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; }
if(nbt.contains("action")) { if(nbt.contains("action")) {
boolean changed = false; boolean changed = false;
final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1; final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1;
switch(nbt.getString("action")) { switch(nbt.getString("action")) {
case DecorHopperGui.QUICK_MOVE_ALL: { case QUICK_MOVE_ALL: {
if((slotId >= STORAGE_SLOT_BEGIN) && (slotId < STORAGE_SLOT_END) && (getSlot(slotId).getHasStack())) { if((slotId >= STORAGE_SLOT_BEGIN) && (slotId < STORAGE_SLOT_END) && (getSlot(slotId).getHasStack())) {
final Slot slot = getSlot(slotId); final Slot slot = getSlot(slotId);
ItemStack remaining = slot.getStack(); ItemStack remaining = slot.getStack();
@ -836,13 +836,11 @@ public class BlockDecorHopper
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class DecorHopperGui extends ContainerScreen<DecorHopperContainer> public static class HopperGui extends ContainerScreen<HopperContainer>
{ {
protected static final String QUICK_MOVE_ALL = "quick-move-all";
protected final PlayerEntity player_; protected final PlayerEntity player_;
public DecorHopperGui(DecorHopperContainer container, PlayerInventory player_inventory, ITextComponent title) public HopperGui(HopperContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -863,7 +861,7 @@ public class BlockDecorHopper
if((type == ClickType.QUICK_MOVE) && (slot!=null) && slot.getHasStack() && Auxiliaries.isShiftDown() && Auxiliaries.isCtrlDown()) { if((type == ClickType.QUICK_MOVE) && (slot!=null) && slot.getHasStack() && Auxiliaries.isShiftDown() && Auxiliaries.isCtrlDown()) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("slot", slotId); nbt.putInt("slot", slotId);
container.onGuiAction(QUICK_MOVE_ALL, nbt); container.onGuiAction(HopperContainer.QUICK_MOVE_ALL, nbt);
} else { } else {
super.handleMouseClick(slot, slotId, button, type); super.handleMouseClick(slot, slotId, button, type);
} }
@ -872,7 +870,7 @@ public class BlockDecorHopper
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
{ {
DecorHopperContainer container = (DecorHopperContainer)getContainer(); HopperContainer container = (HopperContainer)getContainer();
int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5); int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5);
if((!isPointInRegion(126, 1, 49, 60, mouseX, mouseY))) { if((!isPointInRegion(126, 1, 49, 60, mouseX, mouseY))) {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
@ -883,8 +881,8 @@ public class BlockDecorHopper
} else if(range >= 34) { } else if(range >= 34) {
range = container.field(0) + 1; // + range = container.field(0) + 1; // +
} else { } else {
range = (int)(0.5 + ((((double)DecorHopperTileEntity.MAX_COLLECTION_RANGE) * range)/34)); // slider range = (int)(0.5 + ((((double)HopperTileEntity.MAX_COLLECTION_RANGE) * range)/34)); // slider
range = MathHelper.clamp(range, 0, DecorHopperTileEntity.MAX_COLLECTION_RANGE); range = MathHelper.clamp(range, 0, HopperTileEntity.MAX_COLLECTION_RANGE);
} }
container.onGuiAction("range", range); container.onGuiAction("range", range);
} else if(isPointInRegion(128, 21, 44, 10, mouseX, mouseY)) { } else if(isPointInRegion(128, 21, 44, 10, mouseX, mouseY)) {
@ -905,15 +903,15 @@ public class BlockDecorHopper
} else if(ndrop >= 34) { } else if(ndrop >= 34) {
ndrop = container.field(1) + 1; // + ndrop = container.field(1) + 1; // +
} else { } else {
ndrop = MathHelper.clamp(1+ndrop, 1, DecorHopperTileEntity.MAX_TRANSFER_COUNT); // slider ndrop = MathHelper.clamp(1+ndrop, 1, HopperTileEntity.MAX_TRANSFER_COUNT); // slider
} }
container.onGuiAction("xsize", ndrop); container.onGuiAction("xsize", ndrop);
} else if(isPointInRegion(133, 49, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(133, 49, 9, 9, mouseX, mouseY)) {
container.onGuiAction("manual_trigger", 1); container.onGuiAction("manual_trigger", 1);
} else if(isPointInRegion(145, 49, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(145, 49, 9, 9, mouseX, mouseY)) {
container.onGuiAction("logic", container.field(2) ^ DecorHopperTileEntity.LOGIC_INVERTED); container.onGuiAction("logic", container.field(2) ^ HopperTileEntity.LOGIC_INVERTED);
} else if(isPointInRegion(159, 49, 7, 9, mouseX, mouseY)) { } else if(isPointInRegion(159, 49, 7, 9, mouseX, mouseY)) {
container.onGuiAction("logic", container.field(2) ^ DecorHopperTileEntity.LOGIC_CONTINUOUS); container.onGuiAction("logic", container.field(2) ^ HopperTileEntity.LOGIC_CONTINUOUS);
} }
return true; return true;
} }
@ -925,11 +923,11 @@ public class BlockDecorHopper
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_hopper_gui.png")); this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_hopper_gui.png"));
final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize(); final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize();
blit(x0, y0, 0, 0, w, h); blit(x0, y0, 0, 0, w, h);
DecorHopperContainer container = (DecorHopperContainer)getContainer(); HopperContainer container = (HopperContainer)getContainer();
// active slot // active slot
{ {
int slot_index = container.field(6); int slot_index = container.field(6);
if((slot_index < 0) || (slot_index >= DecorHopperTileEntity.NUM_OF_SLOTS)) slot_index = 0; if((slot_index < 0) || (slot_index >= HopperTileEntity.NUM_OF_SLOTS)) slot_index = 0;
int x = (x0+10+((slot_index % 6) * 18)); int x = (x0+10+((slot_index % 6) * 18));
int y = (y0+8+((slot_index / 6) * 17)); int y = (y0+8+((slot_index / 6) * 17));
blit(x, y, 200, 8, 18, 18); blit(x, y, 200, 8, 18, 18);
@ -937,7 +935,7 @@ public class BlockDecorHopper
// collection range // collection range
{ {
int lut[] = { 133, 141, 149, 157, 166 }; int lut[] = { 133, 141, 149, 157, 166 };
int px = lut[MathHelper.clamp(container.field(0), 0, DecorHopperTileEntity.MAX_COLLECTION_RANGE)]; int px = lut[MathHelper.clamp(container.field(0), 0, HopperTileEntity.MAX_COLLECTION_RANGE)];
int x = x0 + px - 2; int x = x0 + px - 2;
int y = y0 + 14; int y = y0 + 14;
blit(x, y, 179, 40, 5, 5); blit(x, y, 179, 40, 5, 5);
@ -963,14 +961,14 @@ public class BlockDecorHopper
} }
// trigger logic // trigger logic
{ {
int inverter_offset = ((container.field(2) & DecorHopperTileEntity.LOGIC_INVERTED) != 0) ? 11 : 0; int inverter_offset = ((container.field(2) & HopperTileEntity.LOGIC_INVERTED) != 0) ? 11 : 0;
blit(x0+145, y0+49, 177+inverter_offset, 49, 9, 9); blit(x0+145, y0+49, 177+inverter_offset, 49, 9, 9);
int pulse_mode_offset = ((container.field(2) & DecorHopperTileEntity.LOGIC_CONTINUOUS ) != 0) ? 9 : 0; int pulse_mode_offset = ((container.field(2) & HopperTileEntity.LOGIC_CONTINUOUS ) != 0) ? 9 : 0;
blit(x0+159, y0+49, 199+pulse_mode_offset, 49, 9, 9); blit(x0+159, y0+49, 199+pulse_mode_offset, 49, 9, 9);
} }
// delay timer running indicator // delay timer running indicator
{ {
if((container.field(4) > DecorHopperTileEntity.PERIOD_OFFSET) && ((System.currentTimeMillis() % 1000) < 500)) { if((container.field(4) > HopperTileEntity.PERIOD_OFFSET) && ((System.currentTimeMillis() % 1000) < 500)) {
blit(x0+148, y0+22, 187, 22, 3, 3); blit(x0+148, y0+22, 187, 22, 3, 3);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorHorizontalSupport.java * @file EdHorizontalSupportBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -36,7 +36,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
public class BlockDecorHorizontalSupport extends StandardBlocks.WaterLoggable implements IWaterLoggable, IDecorBlock public class EdHorizontalSupportBlock extends StandardBlocks.WaterLoggable implements IWaterLoggable, IDecorBlock
{ {
public static final BooleanProperty EASTWEST = BooleanProperty.create("eastwest"); public static final BooleanProperty EASTWEST = BooleanProperty.create("eastwest");
public static final BooleanProperty LEFTBEAM = BooleanProperty.create("leftbeam"); public static final BooleanProperty LEFTBEAM = BooleanProperty.create("leftbeam");
@ -44,7 +44,7 @@ public class BlockDecorHorizontalSupport extends StandardBlocks.WaterLoggable im
public static final IntegerProperty DOWNCONNECT = IntegerProperty.create("downconnect", 0, 2); public static final IntegerProperty DOWNCONNECT = IntegerProperty.create("downconnect", 0, 2);
protected final ArrayList<VoxelShape> AABBs; protected final ArrayList<VoxelShape> AABBs;
public BlockDecorHorizontalSupport(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdHorizontalSupportBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ {
super(config|StandardBlocks.CFG_HORIZIONTAL, builder); super(config|StandardBlocks.CFG_HORIZIONTAL, builder);
AABBs = new ArrayList<VoxelShape>(Arrays.asList( AABBs = new ArrayList<VoxelShape>(Arrays.asList(
@ -96,9 +96,9 @@ public class BlockDecorHorizontalSupport extends StandardBlocks.WaterLoggable im
final BlockState lstate = world.getBlockState((!ew) ? (pos.west()) : (pos.north()) ); final BlockState lstate = world.getBlockState((!ew) ? (pos.west()) : (pos.north()) );
final BlockState dstate = world.getBlockState(pos.down()); final BlockState dstate = world.getBlockState(pos.down());
int down_connector = 0; int down_connector = 0;
if((dstate.getBlock() instanceof BlockDecorStraightPole)) { if((dstate.getBlock() instanceof EdStraightPoleBlock)) {
final Direction dfacing = dstate.get(BlockDecorStraightPole.FACING); final Direction dfacing = dstate.get(EdStraightPoleBlock.FACING);
final BlockDecorStraightPole pole = (BlockDecorStraightPole)dstate.getBlock(); final EdStraightPoleBlock pole = (EdStraightPoleBlock)dstate.getBlock();
if((dfacing.getAxis() == Direction.Axis.Y)) { if((dfacing.getAxis() == Direction.Axis.Y)) {
if((pole== ModContent.THICK_STEEL_POLE) || ((pole==ModContent.THICK_STEEL_POLE_HEAD) && (dfacing==Direction.UP))) { if((pole== ModContent.THICK_STEEL_POLE) || ((pole==ModContent.THICK_STEEL_POLE_HEAD) && (dfacing==Direction.UP))) {
down_connector = 2; down_connector = 2;

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorLabeledCrate.java * @file EdLabeledCrate.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -62,7 +62,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
public class BlockDecorLabeledCrate public class EdLabeledCrate
{ {
private static boolean with_gui_mouse_handling = true; private static boolean with_gui_mouse_handling = true;
private static final HashSet<Item> unstorable_containers = new HashSet<Item>(); private static final HashSet<Item> unstorable_containers = new HashSet<Item>();
@ -80,9 +80,9 @@ public class BlockDecorLabeledCrate
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorLabeledCrateBlock extends StandardBlocks.Horizontal implements IDecorBlock public static class LabeledCrateBlock extends StandardBlocks.Horizontal implements IDecorBlock
{ {
public DecorLabeledCrateBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public LabeledCrateBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override
@ -520,6 +520,10 @@ public class BlockDecorLabeledCrate
public static class LabeledCrateContainer extends Container implements Networking.INetworkSynchronisableContainer public static class LabeledCrateContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
protected static final String QUICK_MOVE_ALL = "quick-move-all";
protected static final String INCREASE_STACK = "increase-stack";
protected static final String DECREASE_STACK = "decrease-stack";
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
protected static class StorageSlot extends Slot protected static class StorageSlot extends Slot
{ {
@ -649,7 +653,7 @@ public class BlockDecorLabeledCrate
if(!nbt.contains("action")) return; if(!nbt.contains("action")) return;
final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1; final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1;
switch(nbt.getString("action")) { switch(nbt.getString("action")) {
case LabeledCrateGui.QUICK_MOVE_ALL: { case QUICK_MOVE_ALL: {
if((slotId >= STORAGE_SLOT_BEGIN) && (slotId < STORAGE_SLOT_END) && (getSlot(slotId).getHasStack())) { if((slotId >= STORAGE_SLOT_BEGIN) && (slotId < STORAGE_SLOT_END) && (getSlot(slotId).getHasStack())) {
final Slot slot = getSlot(slotId); final Slot slot = getSlot(slotId);
ItemStack remaining = slot.getStack(); ItemStack remaining = slot.getStack();
@ -681,9 +685,9 @@ public class BlockDecorLabeledCrate
} }
changed = true; changed = true;
} break; } break;
case LabeledCrateGui.INCREASE_STACK: { case INCREASE_STACK: {
} break; } break;
case LabeledCrateGui.DECREASE_STACK: { case DECREASE_STACK: {
} break; } break;
} }
if(changed) { if(changed) {
@ -701,10 +705,6 @@ public class BlockDecorLabeledCrate
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class LabeledCrateGui extends ContainerScreen<LabeledCrateContainer> public static class LabeledCrateGui extends ContainerScreen<LabeledCrateContainer>
{ {
protected static final String QUICK_MOVE_ALL = "quick-move-all";
protected static final String INCREASE_STACK = "increase-stack";
protected static final String DECREASE_STACK = "decrease-stack";
protected final PlayerEntity player_; protected final PlayerEntity player_;
public LabeledCrateGui(LabeledCrateContainer container, PlayerInventory player_inventory, ITextComponent title) public LabeledCrateGui(LabeledCrateContainer container, PlayerInventory player_inventory, ITextComponent title)
@ -752,7 +752,7 @@ public class BlockDecorLabeledCrate
} else if((type == ClickType.QUICK_MOVE) && (slot!=null) && slot.getHasStack() && Auxiliaries.isShiftDown() && Auxiliaries.isCtrlDown()) { } else if((type == ClickType.QUICK_MOVE) && (slot!=null) && slot.getHasStack() && Auxiliaries.isShiftDown() && Auxiliaries.isCtrlDown()) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("slot", slotId); nbt.putInt("slot", slotId);
action(QUICK_MOVE_ALL, nbt); action(LabeledCrateContainer.QUICK_MOVE_ALL, nbt);
} else { } else {
super.handleMouseClick(slot, slotId, button, type); super.handleMouseClick(slot, slotId, button, type);
} }
@ -772,7 +772,7 @@ public class BlockDecorLabeledCrate
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("slot", slot.slotNumber); nbt.putInt("slot", slot.slotNumber);
if(limit > 1) nbt.putInt("limit", limit); if(limit > 1) nbt.putInt("limit", limit);
action(INCREASE_STACK, nbt); action(LabeledCrateContainer.INCREASE_STACK, nbt);
} }
} }
} else if(wheel_inc < -0.1) { } else if(wheel_inc < -0.1) {
@ -780,7 +780,7 @@ public class BlockDecorLabeledCrate
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("slot", slot.slotNumber); nbt.putInt("slot", slot.slotNumber);
if(limit > 1) nbt.putInt("limit", limit); if(limit > 1) nbt.putInt("limit", limit);
action(DECREASE_STACK, nbt); action(LabeledCrateContainer.DECREASE_STACK, nbt);
} }
} }
return true; return true;

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorLadder.java * @file EdLadderBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -35,7 +35,7 @@ import java.util.List;
public class BlockDecorLadder extends LadderBlock implements IDecorBlock public class EdLadderBlock extends LadderBlock implements IDecorBlock
{ {
protected static final AxisAlignedBB EDLADDER_UNROTATED_AABB = Auxiliaries.getPixeledAABB(3, 0, 0, 13, 16, 3); protected static final AxisAlignedBB EDLADDER_UNROTATED_AABB = Auxiliaries.getPixeledAABB(3, 0, 0, 13, 16, 3);
protected static final VoxelShape EDLADDER_SOUTH_AABB = VoxelShapes.create(Auxiliaries.getRotatedAABB(EDLADDER_UNROTATED_AABB, Direction.SOUTH, false)); protected static final VoxelShape EDLADDER_SOUTH_AABB = VoxelShapes.create(Auxiliaries.getRotatedAABB(EDLADDER_UNROTATED_AABB, Direction.SOUTH, false));
@ -47,7 +47,7 @@ public class BlockDecorLadder extends LadderBlock implements IDecorBlock
public static void on_config(boolean without_speed_boost) public static void on_config(boolean without_speed_boost)
{ without_speed_boost_ = without_speed_boost; } { without_speed_boost_ = without_speed_boost; }
public BlockDecorLadder(long config, Block.Properties builder) public EdLadderBlock(long config, Block.Properties builder)
{ super(builder); } { super(builder); }
@Override @Override
@ -87,7 +87,7 @@ public class BlockDecorLadder extends LadderBlock implements IDecorBlock
if(Math.abs(lvy) < 0.94) return; if(Math.abs(lvy) < 0.94) return;
final BlockPos pos = new BlockPos(player.posX, player.posY, player.posZ); final BlockPos pos = new BlockPos(player.posX, player.posY, player.posZ);
final BlockState state = player.world.getBlockState(pos); final BlockState state = player.world.getBlockState(pos);
if(!(state.getBlock() instanceof BlockDecorLadder)) return; if(!(state.getBlock() instanceof EdLadderBlock)) return;
player.fallDistance = 0; player.fallDistance = 0;
player.setMotionMultiplier(state, new Vec3d(0.2, (lvy>0)?(3):(6), 0.2)); player.setMotionMultiplier(state, new Vec3d(0.2, (lvy>0)?(3):(6), 0.2));
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorMilker.java * @file EdMilker.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -10,7 +10,7 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.detail.ExtItems; import wile.engineersdecor.detail.ExternalObjects;
import wile.engineersdecor.libmc.blocks.StandardBlocks; import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.libmc.detail.Inventories;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -54,87 +54,94 @@ import java.util.Map.Entry;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class BlockDecorMilker extends StandardBlocks.Horizontal implements IDecorBlock public class EdMilker
{ {
public static final BooleanProperty FILLED = BooleanProperty.create("filled"); //--------------------------------------------------------------------------------------------------------------------
public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); // Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorMilker(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) public static class MilkerBlock extends StandardBlocks.Horizontal implements IDecorBlock
{ super(config, builder, unrotatedAABBs); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(ACTIVE); builder.add(FILLED); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(FILLED, false).with(ACTIVE, false); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos)
{ {
BTileEntity te = getTe(world, pos); public static final BooleanProperty FILLED = BooleanProperty.create("filled");
return (te==null) ? 0 : MathHelper.clamp((16 * te.fluid_level())/BTileEntity.TANK_CAPACITY, 0, 15); public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
}
@Override public MilkerBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
public boolean hasTileEntity(BlockState state) { super(config, builder, unrotatedAABBs); }
{ return true; }
@Override @Override
@Nullable protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
public TileEntity createTileEntity(BlockState state, IBlockReader world) { super.fillStateContainer(builder); builder.add(ACTIVE); builder.add(FILLED); }
{ return new BTileEntity(); }
@Override @Override
@SuppressWarnings("deprecation") @Nullable
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public BlockState getStateForPlacement(BlockItemUseContext context)
{ { return super.getStateForPlacement(context).with(FILLED, false).with(ACTIVE, false); }
if(world.isRemote) return true;
BTileEntity te = getTe(world, pos); @Override
if(te==null) return true; @SuppressWarnings("deprecation")
final ItemStack in_stack = player.getHeldItem(hand); public boolean hasComparatorInputOverride(BlockState state)
final ItemStack out_stack = BTileEntity.milk_filled_container_item(in_stack); { return true; }
if(out_stack.isEmpty() && (te.fluid_handler()!=null)) return FluidUtil.interactWithFluidHandler(player, hand, te.fluid_handler());
boolean drained = false; @Override
IItemHandler player_inventory = new PlayerMainInvWrapper(player.inventory); @SuppressWarnings("deprecation")
if(te.fluid_level() >= BTileEntity.BUCKET_SIZE) { public int getComparatorInputOverride(BlockState state, World world, BlockPos pos)
final ItemStack insert_stack = out_stack.copy(); {
ItemStack remainder = ItemHandlerHelper.insertItemStacked(player_inventory, insert_stack, false); MilkerTileEntity te = getTe(world, pos);
if(remainder.getCount() < insert_stack.getCount()) { return (te==null) ? 0 : MathHelper.clamp((16 * te.fluid_level())/MilkerTileEntity.TANK_CAPACITY, 0, 15);
te.drain(BTileEntity.BUCKET_SIZE); }
in_stack.shrink(1);
drained = true; @Override
if(remainder.getCount() > 0) { public boolean hasTileEntity(BlockState state)
final ItemEntity ei = new ItemEntity(world, player.posX, player.posY + 0.5, player.posZ, remainder); { return true; }
ei.setPickupDelay(40);
ei.setMotion(0,0,0); @Override
world.addEntity(ei); @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new MilkerTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
if(world.isRemote) return true;
MilkerTileEntity te = getTe(world, pos);
if(te==null) return true;
final ItemStack in_stack = player.getHeldItem(hand);
final ItemStack out_stack = MilkerTileEntity.milk_filled_container_item(in_stack);
if(out_stack.isEmpty() && (te.fluid_handler()!=null)) return FluidUtil.interactWithFluidHandler(player, hand, te.fluid_handler());
boolean drained = false;
IItemHandler player_inventory = new PlayerMainInvWrapper(player.inventory);
if(te.fluid_level() >= MilkerTileEntity.BUCKET_SIZE) {
final ItemStack insert_stack = out_stack.copy();
ItemStack remainder = ItemHandlerHelper.insertItemStacked(player_inventory, insert_stack, false);
if(remainder.getCount() < insert_stack.getCount()) {
te.drain(MilkerTileEntity.BUCKET_SIZE);
in_stack.shrink(1);
drained = true;
if(remainder.getCount() > 0) {
final ItemEntity ei = new ItemEntity(world, player.posX, player.posY + 0.5, player.posZ, remainder);
ei.setPickupDelay(40);
ei.setMotion(0,0,0);
world.addEntity(ei);
}
} }
} }
if(drained) {
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 0.8f, 1f);
}
return true;
} }
if(drained) {
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 0.8f, 1f);
}
return true;
}
@Nullable @Nullable
private BTileEntity getTe(World world, BlockPos pos) private MilkerTileEntity getTe(World world, BlockPos pos)
{ final TileEntity te=world.getTileEntity(pos); return (!(te instanceof BTileEntity)) ? (null) : ((BTileEntity)te); } { final TileEntity te=world.getTileEntity(pos); return (!(te instanceof MilkerTileEntity)) ? (null) : ((MilkerTileEntity)te); }
}
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage, IFluidTank, ICapabilityProvider public static class MilkerTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage, IFluidTank, ICapabilityProvider
{ {
public static final int BUCKET_SIZE = 1000; public static final int BUCKET_SIZE = 1000;
public static final int TICK_INTERVAL = 80; public static final int TICK_INTERVAL = 80;
@ -173,19 +180,19 @@ public class BlockDecorMilker extends StandardBlocks.Horizontal implements IDeco
} }
{ {
milk_containers_.put(new ItemStack(Items.BUCKET), new ItemStack(Items.MILK_BUCKET)); milk_containers_.put(new ItemStack(Items.BUCKET), new ItemStack(Items.MILK_BUCKET));
if(ExtItems.BOTTLED_MILK_BOTTLE_DRINKLABLE!=null) milk_containers_.put(new ItemStack(Items.GLASS_BOTTLE), new ItemStack(ExtItems.BOTTLED_MILK_BOTTLE_DRINKLABLE)); if(ExternalObjects.BOTTLED_MILK_BOTTLE_DRINKLABLE!=null) milk_containers_.put(new ItemStack(Items.GLASS_BOTTLE), new ItemStack(ExternalObjects.BOTTLED_MILK_BOTTLE_DRINKLABLE));
} }
ModEngineersDecor.logger().info( ModEngineersDecor.logger().info(
"Config milker energy consumption:" + energy_consumption + "rf/t" "Config milker energy consumption:" + energy_consumption + "rf/t"
+ ((milk_fluid_==null)?"":" [milk fluid available]") + ((milk_fluid_==null)?"":" [milk fluid available]")
+ ((ExtItems.BOTTLED_MILK_BOTTLE_DRINKLABLE==null)?"":" [bottledmilk mod available]") + ((ExternalObjects.BOTTLED_MILK_BOTTLE_DRINKLABLE==null)?"":" [bottledmilk mod available]")
); );
} }
public BTileEntity() public MilkerTileEntity()
{ this(ModContent.TET_SMALL_MILKING_MACHINE); } { this(ModContent.TET_SMALL_MILKING_MACHINE); }
public BTileEntity(TileEntityType<?> te_type) public MilkerTileEntity(TileEntityType<?> te_type)
{ super(te_type); reset(); } { super(te_type); reset(); }
public void reset() public void reset()
@ -273,8 +280,8 @@ public class BlockDecorMilker extends StandardBlocks.Horizontal implements IDeco
private static class OutputFluidHandler implements IFluidHandler private static class OutputFluidHandler implements IFluidHandler
{ {
private final BTileEntity te; private final MilkerTileEntity te;
OutputFluidHandler(BTileEntity te) { this.te = te; } OutputFluidHandler(MilkerTileEntity te) { this.te = te; }
@Override public int getTanks() { return 1; } @Override public int getTanks() { return 1; }
@Override public FluidStack getFluidInTank(int tank) { return te.getFluid(); } @Override public FluidStack getFluidInTank(int tank) { return te.getFluid(); }
@Override public int getTankCapacity(int tank) { return te.getCapacity(); } @Override public int getTankCapacity(int tank) { return te.getCapacity(); }
@ -384,7 +391,7 @@ public class BlockDecorMilker extends StandardBlocks.Horizontal implements IDeco
private boolean milking_process() private boolean milking_process()
{ {
if((tracked_cow_ == null) && (fluid_level() >= MAX_MILKING_TANK_LEVEL)) return false; // nothing to do if((tracked_cow_ == null) && (fluid_level() >= MAX_MILKING_TANK_LEVEL)) return false; // nothing to do
final Direction facing = world.getBlockState(getPos()).get(HORIZONTAL_FACING).getOpposite(); final Direction facing = world.getBlockState(getPos()).get(MilkerBlock.HORIZONTAL_FACING).getOpposite();
final Vec3d target_pos = new Vec3d(getPos().offset(facing)).add(0.5,0,0.5); final Vec3d target_pos = new Vec3d(getPos().offset(facing)).add(0.5,0,0.5);
CowEntity cow = null; CowEntity cow = null;
{ {
@ -548,11 +555,11 @@ public class BlockDecorMilker extends StandardBlocks.Horizontal implements IDeco
// Adjacent inventory update, only done just after milking to prevent waste of server cpu. // Adjacent inventory update, only done just after milking to prevent waste of server cpu.
if(dirty && (fluid_level() >= BUCKET_SIZE)) { if(dirty && (fluid_level() >= BUCKET_SIZE)) {
log("Try item transfer"); log("Try item transfer");
fill_adjacent_inventory_item_containers(block_state.get(HORIZONTAL_FACING)); fill_adjacent_inventory_item_containers(block_state.get(MilkerBlock.HORIZONTAL_FACING));
} }
} }
// State update // State update
BlockState new_state = block_state.with(FILLED, fluid_level()>=FILLED_INDICATION_THRESHOLD).with(ACTIVE, state_==MilkingState.MILKING); BlockState new_state = block_state.with(MilkerBlock.FILLED, fluid_level()>=FILLED_INDICATION_THRESHOLD).with(MilkerBlock.ACTIVE, state_==MilkingState.MILKING);
if(block_state != new_state) world.setBlockState(pos, new_state,1|2|16); if(block_state != new_state) world.setBlockState(pos, new_state,1|2|16);
if(dirty) markDirty(); if(dirty) markDirty();
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorMineralSmelter.java * @file EdMineralSmelter.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -54,18 +54,18 @@ import javax.annotation.Nullable;
import java.util.*; import java.util.*;
public class BlockDecorMineralSmelter public class EdMineralSmelter
{ {
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorMineralSmelterBlock extends StandardBlocks.Horizontal implements IDecorBlock public static class MineralSmelterBlock extends StandardBlocks.Horizontal implements IDecorBlock
{ {
public static final int PHASE_MAX = 3; public static final int PHASE_MAX = 3;
public static final IntegerProperty PHASE = IntegerProperty.create("phase", 0, PHASE_MAX); public static final IntegerProperty PHASE = IntegerProperty.create("phase", 0, PHASE_MAX);
public DecorMineralSmelterBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public MineralSmelterBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override
@ -94,7 +94,7 @@ public class BlockDecorMineralSmelter
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorMineralSmelter.DecorMineralSmelterTileEntity(); } { return new MineralSmelterTileEntity(); }
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
@ -109,7 +109,7 @@ public class BlockDecorMineralSmelter
{ {
final List<ItemStack> stacks = new ArrayList<ItemStack>(); final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; if(world.isRemote) return stacks;
final DecorMineralSmelterTileEntity te = getTe(world, pos); final MineralSmelterTileEntity te = getTe(world, pos);
if(te == null) return stacks; if(te == null) return stacks;
te.reset_process(); te.reset_process();
stacks.add(new ItemStack(this, 1)); stacks.add(new ItemStack(this, 1));
@ -122,13 +122,13 @@ public class BlockDecorMineralSmelter
{ {
if(world.isRemote) return true; if(world.isRemote) return true;
if(player.isSneaking()) return false; if(player.isSneaking()) return false;
DecorMineralSmelterTileEntity te = getTe(world, pos); MineralSmelterTileEntity te = getTe(world, pos);
if(te==null) return true; if(te==null) return true;
final ItemStack stack = player.getHeldItem(hand); final ItemStack stack = player.getHeldItem(hand);
boolean dirty = false; boolean dirty = false;
if(te.accepts_lava_container(stack)) { if(te.accepts_lava_container(stack)) {
if(stack.isItemEqualIgnoreDurability(DecorMineralSmelterTileEntity.BUCKET_STACK)) { // check how this works with item capabilities or so if(stack.isItemEqualIgnoreDurability(MineralSmelterTileEntity.BUCKET_STACK)) { // check how this works with item capabilities or so
if(te.fluid_level() >= DecorMineralSmelterTileEntity.MAX_BUCKET_EXTRACT_FLUID_LEVEL) { if(te.fluid_level() >= MineralSmelterTileEntity.MAX_BUCKET_EXTRACT_FLUID_LEVEL) {
if(stack.getCount() > 1) { if(stack.getCount() > 1) {
int target_stack_index = -1; int target_stack_index = -1;
for(int i=0; i<player.inventory.getSizeInventory(); ++i) { for(int i=0; i<player.inventory.getSizeInventory(); ++i) {
@ -141,13 +141,13 @@ public class BlockDecorMineralSmelter
te.reset_process(); te.reset_process();
stack.shrink(1); stack.shrink(1);
player.setHeldItem(hand, stack); player.setHeldItem(hand, stack);
player.inventory.setInventorySlotContents(target_stack_index, DecorMineralSmelterTileEntity.LAVA_BUCKET_STACK.copy()); player.inventory.setInventorySlotContents(target_stack_index, MineralSmelterTileEntity.LAVA_BUCKET_STACK.copy());
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1f, 1f); world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1f, 1f);
dirty = true; dirty = true;
} }
} else { } else {
te.reset_process(); te.reset_process();
player.setHeldItem(hand, DecorMineralSmelterTileEntity.LAVA_BUCKET_STACK.copy()); player.setHeldItem(hand, MineralSmelterTileEntity.LAVA_BUCKET_STACK.copy());
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1f, 1f); world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1f, 1f);
dirty = true; dirty = true;
} }
@ -155,7 +155,7 @@ public class BlockDecorMineralSmelter
} }
} else if(stack.isEmpty()) { } else if(stack.isEmpty()) {
final ItemStack istack = te.getStackInSlot(1).copy(); final ItemStack istack = te.getStackInSlot(1).copy();
if(te.phase() > DecorMineralSmelterTileEntity.PHASE_WARMUP) player.setFire(1); if(te.phase() > MineralSmelterTileEntity.PHASE_WARMUP) player.setFire(1);
if(!istack.isEmpty()) { if(!istack.isEmpty()) {
istack.setCount(1); istack.setCount(1);
player.setHeldItem(hand, istack); player.setHeldItem(hand, istack);
@ -177,16 +177,16 @@ public class BlockDecorMineralSmelter
if(state.getBlock()!=this) return; if(state.getBlock()!=this) return;
IParticleData particle = ParticleTypes.SMOKE; IParticleData particle = ParticleTypes.SMOKE;
switch(state.get(PHASE)) { switch(state.get(PHASE)) {
case DecorMineralSmelterTileEntity.PHASE_WARMUP: case MineralSmelterTileEntity.PHASE_WARMUP:
return; return;
case DecorMineralSmelterTileEntity.PHASE_HOT: case MineralSmelterTileEntity.PHASE_HOT:
if(rnd.nextInt(10) > 4) return; if(rnd.nextInt(10) > 4) return;
break; break;
case DecorMineralSmelterTileEntity.PHASE_MAGMABLOCK: case MineralSmelterTileEntity.PHASE_MAGMABLOCK:
if(rnd.nextInt(10) > 7) return; if(rnd.nextInt(10) > 7) return;
particle = ParticleTypes.LARGE_SMOKE; particle = ParticleTypes.LARGE_SMOKE;
break; break;
case DecorMineralSmelterTileEntity.PHASE_LAVA: case MineralSmelterTileEntity.PHASE_LAVA:
if(rnd.nextInt(10) > 2) return; if(rnd.nextInt(10) > 2) return;
particle = ParticleTypes.LAVA; particle = ParticleTypes.LAVA;
break; break;
@ -199,15 +199,15 @@ public class BlockDecorMineralSmelter
} }
@Nullable @Nullable
private DecorMineralSmelterTileEntity getTe(World world, BlockPos pos) private MineralSmelterTileEntity getTe(World world, BlockPos pos)
{ final TileEntity te=world.getTileEntity(pos); return (!(te instanceof DecorMineralSmelterTileEntity)) ? (null) : ((DecorMineralSmelterTileEntity)te); } { final TileEntity te=world.getTileEntity(pos); return (!(te instanceof MineralSmelterTileEntity)) ? (null) : ((MineralSmelterTileEntity)te); }
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorMineralSmelterTileEntity extends TileEntity implements INameable, ITickableTileEntity, ISidedInventory, IEnergyStorage, ICapabilityProvider public static class MineralSmelterTileEntity extends TileEntity implements INameable, ITickableTileEntity, ISidedInventory, IEnergyStorage, ICapabilityProvider
{ {
public static final int TICK_INTERVAL = 20; public static final int TICK_INTERVAL = 20;
public static final int MAX_FLUID_LEVEL = 1000; public static final int MAX_FLUID_LEVEL = 1000;
@ -249,10 +249,10 @@ public class BlockDecorMineralSmelter
ModEngineersDecor.logger().info("Config mineal smelter energy consumption:" + energy_consumption + "rf/t, heat-up rate: " + heatup_rate + "%/s."); ModEngineersDecor.logger().info("Config mineal smelter energy consumption:" + energy_consumption + "rf/t, heat-up rate: " + heatup_rate + "%/s.");
} }
public DecorMineralSmelterTileEntity() public MineralSmelterTileEntity()
{ this(ModContent.TET_MINERAL_SMELTER); } { this(ModContent.TET_MINERAL_SMELTER); }
public DecorMineralSmelterTileEntity(TileEntityType<?> te_type) public MineralSmelterTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public int progress() public int progress()
@ -445,9 +445,9 @@ public class BlockDecorMineralSmelter
protected static class BItemHandler implements IItemHandler protected static class BItemHandler implements IItemHandler
{ {
private DecorMineralSmelterTileEntity te; private MineralSmelterTileEntity te;
BItemHandler(DecorMineralSmelterTileEntity te) BItemHandler(MineralSmelterTileEntity te)
{ this.te = te; } { this.te = te; }
@Override @Override
@ -490,9 +490,9 @@ public class BlockDecorMineralSmelter
private static class BFluidHandler implements IFluidHandler private static class BFluidHandler implements IFluidHandler
{ {
private final FluidStack lava; private final FluidStack lava;
private final DecorMineralSmelterTileEntity te; private final MineralSmelterTileEntity te;
BFluidHandler(DecorMineralSmelterTileEntity te) BFluidHandler(MineralSmelterTileEntity te)
{ this.te = te; lava = new net.minecraftforge.fluids.FluidStack(net.minecraft.fluid.Fluids.LAVA, 1); } { this.te = te; lava = new net.minecraftforge.fluids.FluidStack(net.minecraft.fluid.Fluids.LAVA, 1); }
@Override public int getTanks() { return 1; } @Override public int getTanks() { return 1; }
@ -657,8 +657,8 @@ public class BlockDecorMineralSmelter
} }
// Block state // Block state
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if((state.getBlock() instanceof DecorMineralSmelterBlock) && (force_block_update_ || (state.get(DecorMineralSmelterBlock.PHASE) != new_phase))) { if((state.getBlock() instanceof MineralSmelterBlock) && (force_block_update_ || (state.get(MineralSmelterBlock.PHASE) != new_phase))) {
state = state.with(DecorMineralSmelterBlock.PHASE, new_phase); state = state.with(MineralSmelterBlock.PHASE, new_phase);
world.setBlockState(pos, state,3|16); world.setBlockState(pos, state,3|16);
world.notifyNeighborsOfStateChange(getPos(), state.getBlock()); world.notifyNeighborsOfStateChange(getPos(), state.getBlock());
force_block_update_ = false; force_block_update_ = false;

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorPipeValve.java * @file EdPipeValve.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -42,7 +42,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorPipeValve public class EdPipeValve
{ {
public static final int CFG_CHECK_VALVE = 0x1; public static final int CFG_CHECK_VALVE = 0x1;
public static final int CFG_ANALOG_VALVE = 0x2; public static final int CFG_ANALOG_VALVE = 0x2;
@ -50,16 +50,16 @@ public class BlockDecorPipeValve
public static void on_config(int container_size_decl, int redstone_slope) public static void on_config(int container_size_decl, int redstone_slope)
{ {
DecorPipeValveTileEntity.fluid_maxflow_mb = MathHelper.clamp(container_size_decl, 1, 10000); PipeValveTileEntity.fluid_maxflow_mb = MathHelper.clamp(container_size_decl, 1, 10000);
DecorPipeValveTileEntity.redstone_flow_slope_mb = MathHelper.clamp(redstone_slope, 1, 10000); PipeValveTileEntity.redstone_flow_slope_mb = MathHelper.clamp(redstone_slope, 1, 10000);
ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + DecorPipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + DecorPipeValveTileEntity.redstone_flow_slope_mb + "mb/sig"); ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + PipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + PipeValveTileEntity.redstone_flow_slope_mb + "mb/sig");
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorPipeValveBlock extends StandardBlocks.DirectedWaterLoggable implements IDecorBlock public static class PipeValveBlock extends StandardBlocks.DirectedWaterLoggable implements IDecorBlock
{ {
public static final BooleanProperty RS_CN_N = BooleanProperty.create("rs_n"); public static final BooleanProperty RS_CN_N = BooleanProperty.create("rs_n");
public static final BooleanProperty RS_CN_S = BooleanProperty.create("rs_s"); public static final BooleanProperty RS_CN_S = BooleanProperty.create("rs_s");
@ -70,7 +70,7 @@ public class BlockDecorPipeValve
public final int valve_config; public final int valve_config;
public DecorPipeValveBlock(long config, int valve_config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) public PipeValveBlock(long config, int valve_config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
{ super(config, builder, unrotatedAABB); this.valve_config = valve_config; } { super(config, builder, unrotatedAABB); this.valve_config = valve_config; }
private BlockState get_rsconnector_state(BlockState state, IWorld world, BlockPos pos, @Nullable BlockPos fromPos) private BlockState get_rsconnector_state(BlockState state, IWorld world, BlockPos pos, @Nullable BlockPos fromPos)
@ -130,7 +130,7 @@ public class BlockDecorPipeValve
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new DecorPipeValveTileEntity(); } { return new PipeValveTileEntity(); }
@Override @Override
public BlockState rotate(BlockState state, IWorld world, BlockPos pos, Rotation direction) public BlockState rotate(BlockState state, IWorld world, BlockPos pos, Rotation direction)
@ -161,30 +161,30 @@ public class BlockDecorPipeValve
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorPipeValveTileEntity extends TileEntity implements ICapabilityProvider //, IFluidPipe public static class PipeValveTileEntity extends TileEntity implements ICapabilityProvider //, IFluidPipe
{ {
protected static int fluid_maxflow_mb = 1000; protected static int fluid_maxflow_mb = 1000;
protected static int redstone_flow_slope_mb = 1000/15; protected static int redstone_flow_slope_mb = 1000/15;
private boolean filling_ = false; private boolean filling_ = false;
private long valve_config_ = 0; private long valve_config_ = 0;
public DecorPipeValveTileEntity() public PipeValveTileEntity()
{ this(ModContent.TET_STRAIGHT_PIPE_VALVE); } { this(ModContent.TET_STRAIGHT_PIPE_VALVE); }
public DecorPipeValveTileEntity(TileEntityType<?> te_type) public PipeValveTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
private Direction block_facing() private Direction block_facing()
{ {
BlockState st = getWorld().getBlockState(getPos()); BlockState st = getWorld().getBlockState(getPos());
return (st.getBlock() instanceof DecorPipeValveBlock) ? st.get(DecorPipeValveBlock.FACING) : Direction.NORTH; return (st.getBlock() instanceof PipeValveBlock) ? st.get(PipeValveBlock.FACING) : Direction.NORTH;
} }
private long valve_config() private long valve_config()
{ {
if(valve_config_ <= 0) { if(valve_config_ <= 0) {
final Block block = getWorld().getBlockState(getPos()).getBlock(); final Block block = getWorld().getBlockState(getPos()).getBlock();
if(block instanceof DecorPipeValveBlock) valve_config_ = ((DecorPipeValveBlock)block).valve_config; if(block instanceof PipeValveBlock) valve_config_ = ((PipeValveBlock)block).valve_config;
} }
return valve_config_; return valve_config_;
} }
@ -232,8 +232,8 @@ public class BlockDecorPipeValve
private static class MainFlowHandler implements IFluidHandler private static class MainFlowHandler implements IFluidHandler
{ {
private DecorPipeValveTileEntity te; private PipeValveTileEntity te;
public MainFlowHandler(DecorPipeValveTileEntity te) { this.te = te; } public MainFlowHandler(PipeValveTileEntity te) { this.te = te; }
@Override public int getTanks() { return 0; } @Override public int getTanks() { return 0; }
@Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; } @Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; }
@Override public int getTankCapacity(int tank) { return fluid_maxflow_mb; } @Override public int getTankCapacity(int tank) { return fluid_maxflow_mb; }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorPlacer.java * @file EdPlacer.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -55,119 +55,126 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorBlock public class EdPlacer
{ {
public BlockDecorPlacer(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) //--------------------------------------------------------------------------------------------------------------------
{ super(config, builder, unrotatedAABB); } // Block
//--------------------------------------------------------------------------------------------------------------------
@Override public static class PlacerBlock extends StandardBlocks.Directed implements IDecorBlock
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
{ return VoxelShapes.fullCube(); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{ {
if(world.isRemote) return; public PlacerBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return; { super(config, builder, unrotatedAABB); }
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).readnbt(te_nbt, false);
((BTileEntity)te).reset_rtstate();
((BTileEntity)te).markDirty();
}
@Override @Override
public boolean hasDynamicDropList() public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
{ return true; } { return VoxelShapes.fullCube(); }
@Override @Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) @SuppressWarnings("deprecation")
{ public boolean hasComparatorInputOverride(BlockState state)
final List<ItemStack> stacks = new ArrayList<ItemStack>(); { return true; }
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos); @Override
if(!(te instanceof BTileEntity)) return stacks; @SuppressWarnings("deprecation")
if(!explosion) { public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
ItemStack stack = new ItemStack(this, 1); { return Container.calcRedstone(world.getTileEntity(pos)); }
CompoundNBT te_nbt = ((BTileEntity) te).clear_getnbt();
if(!te_nbt.isEmpty()) { @Override
CompoundNBT nbt = new CompoundNBT(); public boolean hasTileEntity(BlockState state)
nbt.put("tedata", te_nbt); { return true; }
stack.setTag(nbt);
} @Override
stacks.add(stack); @Nullable
} else { public TileEntity createTileEntity(BlockState state, IBlockReader world)
for(ItemStack stack: ((BTileEntity)te).stacks_) { { return new PlacerTileEntity(); }
if(!stack.isEmpty()) stacks.add(stack);
} @Override
((BTileEntity)te).reset_rtstate(); public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return;
((PlacerTileEntity)te).readnbt(te_nbt, false);
((PlacerTileEntity)te).reset_rtstate();
((PlacerTileEntity)te).markDirty();
} }
return stacks;
@Override
public boolean hasDynamicDropList()
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return stacks;
if(!explosion) {
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((PlacerTileEntity) te).clear_getnbt();
if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt);
stack.setTag(nbt);
}
stacks.add(stack);
} else {
for(ItemStack stack: ((PlacerTileEntity)te).stacks_) {
if(!stack.isEmpty()) stacks.add(stack);
}
((PlacerTileEntity)te).reset_rtstate();
}
return stacks;
}
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return true;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return;
((PlacerTileEntity)te).block_updated();
}
@Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
@Override
@SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
} }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return true;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).block_updated();
}
@Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
@Override
@SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory public static class PlacerTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory
{ {
public static final int TICK_INTERVAL = 40; public static final int TICK_INTERVAL = 40;
public static final int NUM_OF_SLOTS = 18; public static final int NUM_OF_SLOTS = 18;
@ -188,10 +195,10 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
// ModEngineersDecor.logger.info("Config factory placer:"); // ModEngineersDecor.logger.info("Config factory placer:");
} }
public BTileEntity() public PlacerTileEntity()
{ this(ModContent.TET_FACTORY_PLACER); } { this(ModContent.TET_FACTORY_PLACER); }
public BTileEntity(TileEntityType<?> te_type) public PlacerTileEntity(TileEntityType<?> te_type)
{ {
super(te_type); super(te_type);
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
@ -286,7 +293,7 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new PlacerContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------------------- // IInventory -------------------------------------------------------------------------------------------
@ -350,7 +357,7 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(BTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(PlacerTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
@ -556,7 +563,7 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
boolean trigger = (rssignal && ((block_power_updated_) || ((logic_ & LOGIC_CONTINUOUS)!=0))); boolean trigger = (rssignal && ((block_power_updated_) || ((logic_ & LOGIC_CONTINUOUS)!=0)));
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(state == null) { block_power_signal_= false; return; } if(state == null) { block_power_signal_= false; return; }
final Direction placer_facing = state.get(FACING); final Direction placer_facing = state.get(PlacerBlock.FACING);
// Trigger edge detection for next cycle // Trigger edge detection for next cycle
{ {
boolean tr = world.isBlockPowered(pos); boolean tr = world.isBlockPowered(pos);
@ -572,12 +579,12 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BContainer extends Container implements Networking.INetworkSynchronisableContainer public static class PlacerContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
private static final int PLAYER_INV_START_SLOTNO = BTileEntity.NUM_OF_SLOTS; private static final int PLAYER_INV_START_SLOTNO = PlacerTileEntity.NUM_OF_SLOTS;
private final PlayerEntity player_; private final PlayerEntity player_;
private final IInventory inventory_; private final IInventory inventory_;
private final IWorldPosCallable wpc_; private final IWorldPosCallable wpc_;
@ -585,10 +592,10 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
public final int field(int index) { return fields_.get(index); } public final int field(int index) { return fields_.get(index); }
public BContainer(int cid, PlayerInventory player_inventory) public PlacerContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(BTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(BTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(PlacerTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(PlacerTileEntity.NUM_OF_FIELDS)); }
private BContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private PlacerContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_FACTORY_PLACER, cid); super(ModContent.CT_FACTORY_PLACER, cid);
fields_ = fields; fields_ = fields;
@ -631,7 +638,7 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player slot // Player slot
if(!mergeItemStack(slot_stack, 0, BTileEntity.NUM_OF_SLOTS, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, 0, PlacerTileEntity.NUM_OF_SLOTS, false)) return ItemStack.EMPTY;
} else { } else {
// invalid slot // invalid slot
return ItemStack.EMPTY; return ItemStack.EMPTY;
@ -667,8 +674,8 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
@Override @Override
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
{ {
if(!(inventory_ instanceof BTileEntity)) return; if(!(inventory_ instanceof PlacerTileEntity)) return;
BTileEntity te = (BTileEntity)inventory_; PlacerTileEntity te = (PlacerTileEntity)inventory_;
if(nbt.contains("logic")) te.logic_ = nbt.getInt("logic"); if(nbt.contains("logic")) te.logic_ = nbt.getInt("logic");
if(nbt.contains("manual_trigger") && (nbt.getInt("manual_trigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; } if(nbt.contains("manual_trigger") && (nbt.getInt("manual_trigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; }
te.markDirty(); te.markDirty();
@ -680,11 +687,11 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class BGui extends ContainerScreen<BContainer> public static class PlacerGui extends ContainerScreen<PlacerContainer>
{ {
protected final PlayerEntity player_; protected final PlayerEntity player_;
public BGui(BContainer container, PlayerInventory player_inventory, ITextComponent title) public PlacerGui(PlacerContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -702,16 +709,16 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
{ {
BContainer container = (BContainer)getContainer(); PlacerContainer container = (PlacerContainer)getContainer();
int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5); int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5);
if((!isPointInRegion(126, 1, 49, 60, mouseX, mouseY))) { if((!isPointInRegion(126, 1, 49, 60, mouseX, mouseY))) {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
} else if(isPointInRegion(133, 49, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(133, 49, 9, 9, mouseX, mouseY)) {
container.onGuiAction("manual_trigger", 1); container.onGuiAction("manual_trigger", 1);
} else if(isPointInRegion(145, 49, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(145, 49, 9, 9, mouseX, mouseY)) {
container.onGuiAction("logic", container.field(0) ^ BTileEntity.LOGIC_INVERTED); container.onGuiAction("logic", container.field(0) ^ PlacerTileEntity.LOGIC_INVERTED);
} else if(isPointInRegion(159, 49, 7, 9, mouseX, mouseY)) { } else if(isPointInRegion(159, 49, 7, 9, mouseX, mouseY)) {
container.onGuiAction("logic", container.field(0) ^ BTileEntity.LOGIC_CONTINUOUS); container.onGuiAction("logic", container.field(0) ^ PlacerTileEntity.LOGIC_CONTINUOUS);
} }
return true; return true;
} }
@ -723,11 +730,11 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_placer_gui.png")); this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_placer_gui.png"));
final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize(); final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize();
blit(x0, y0, 0, 0, w, h); blit(x0, y0, 0, 0, w, h);
BContainer container = (BContainer)getContainer(); PlacerContainer container = (PlacerContainer)getContainer();
// active slot // active slot
{ {
int slot_index = container.field(2); int slot_index = container.field(2);
if((slot_index < 0) || (slot_index >= BTileEntity.NUM_OF_SLOTS)) slot_index = 0; if((slot_index < 0) || (slot_index >= PlacerTileEntity.NUM_OF_SLOTS)) slot_index = 0;
int x = (x0+10+((slot_index % 6) * 18)); int x = (x0+10+((slot_index % 6) * 18));
int y = (y0+8+((slot_index / 6) * 17)); int y = (y0+8+((slot_index / 6) * 17));
blit(x, y, 200, 8, 18, 18); blit(x, y, 200, 8, 18, 18);
@ -740,9 +747,9 @@ public class BlockDecorPlacer extends StandardBlocks.Directed implements IDecorB
} }
// trigger logic // trigger logic
{ {
int inverter_offset = ((container.field(0) & BTileEntity.LOGIC_INVERTED) != 0) ? 11 : 0; int inverter_offset = ((container.field(0) & PlacerTileEntity.LOGIC_INVERTED) != 0) ? 11 : 0;
blit(x0+145, y0+49, 177+inverter_offset, 49, 9, 9); blit(x0+145, y0+49, 177+inverter_offset, 49, 9, 9);
int pulse_mode_offset = ((container.field(0) & BTileEntity.LOGIC_CONTINUOUS ) != 0) ? 9 : 0; int pulse_mode_offset = ((container.field(0) & PlacerTileEntity.LOGIC_CONTINUOUS ) != 0) ? 9 : 0;
blit(x0+159, y0+49, 199+pulse_mode_offset, 49, 9, 9); blit(x0+159, y0+49, 199+pulse_mode_offset, 49, 9, 9);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorSlab.java * @file EdSlabBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -11,8 +11,8 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.VariantSlabBlock; import wile.engineersdecor.libmc.blocks.VariantSlabBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
public class BlockDecorSlab extends VariantSlabBlock implements IDecorBlock public class EdSlabBlock extends VariantSlabBlock implements IDecorBlock
{ {
public BlockDecorSlab(long config, Block.Properties builder) public EdSlabBlock(long config, Block.Properties builder)
{ super(config, builder); } { super(config, builder); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorHalfSlab.java * @file EdSlabSliceBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -12,8 +12,8 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.SlabSliceBlock; import wile.engineersdecor.libmc.blocks.SlabSliceBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
public class BlockDecorHalfSlab extends SlabSliceBlock implements IDecorBlock public class EdSlabSliceBlock extends SlabSliceBlock implements IDecorBlock
{ {
public BlockDecorHalfSlab(long config, Block.Properties builder) public EdSlabSliceBlock(long config, Block.Properties builder)
{ super(config, builder); } { super(config, builder); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorSolarPanel.java * @file EdSolarPanel.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -40,49 +40,55 @@ import net.minecraftforge.common.util.LazyOptional;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorSolarPanel extends StandardBlocks.BaseBlock implements IDecorBlock public class EdSolarPanel
{ {
public static final IntegerProperty EXPOSITION = IntegerProperty.create("exposition", 0, 4); //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorSolarPanel(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) public static class SolarPanelBlock extends StandardBlocks.BaseBlock implements IDecorBlock
{ {
super(config, builder, unrotatedAABB); public static final IntegerProperty EXPOSITION = IntegerProperty.create("exposition", 0, 4);
setDefaultState(stateContainer.getBaseState().with(EXPOSITION, 1));
public SolarPanelBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
{
super(config, builder, unrotatedAABB);
setDefaultState(stateContainer.getBaseState().with(EXPOSITION, 1));
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(EXPOSITION); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new SolarPanelTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof SolarPanelTileEntity) ((SolarPanelTileEntity)te).state_message(player);
return true;
}
} }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(EXPOSITION); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorSolarPanel.BTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof BTileEntity) ((BTileEntity)te).state_message(player);
return true;
}
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider, IEnergyStorage public static class SolarPanelTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider, IEnergyStorage
{ {
public static final int DEFAULT_PEAK_POWER = 45; public static final int DEFAULT_PEAK_POWER = 45;
public static final int TICK_INTERVAL = 8; public static final int TICK_INTERVAL = 8;
@ -106,10 +112,10 @@ public class BlockDecorSolarPanel extends StandardBlocks.BaseBlock implements ID
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
public BTileEntity() public SolarPanelTileEntity()
{ this(ModContent.TET_SMALL_SOLAR_PANEL); } { this(ModContent.TET_SMALL_SOLAR_PANEL); }
public BTileEntity(TileEntityType<?> te_type) public SolarPanelTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void readnbt(CompoundNBT nbt, boolean update_packet) public void readnbt(CompoundNBT nbt, boolean update_packet)
@ -206,7 +212,7 @@ public class BlockDecorSolarPanel extends StandardBlocks.BaseBlock implements ID
tick_timer_ = TICK_INTERVAL * 5; tick_timer_ = TICK_INTERVAL * 5;
current_production_ = 0; current_production_ = 0;
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if(state.get((EXPOSITION))!=2) world.setBlockState(pos, state.with(EXPOSITION, 2)); if(state.get((SolarPanelBlock.EXPOSITION))!=2) world.setBlockState(pos, state.with(SolarPanelBlock.EXPOSITION, 2));
return; return;
} }
if(--recalc_timer_ > 0) return; if(--recalc_timer_ > 0) return;
@ -220,7 +226,7 @@ public class BlockDecorSolarPanel extends StandardBlocks.BaseBlock implements ID
else if(theta < 100) e = 2; else if(theta < 100) e = 2;
else if(theta < 135) e = 3; else if(theta < 135) e = 3;
else if(theta < 190) e = 4; else if(theta < 190) e = 4;
BlockState nstate = state.with(EXPOSITION, e); BlockState nstate = state.with(SolarPanelBlock.EXPOSITION, e);
if(nstate != state) world.setBlockState(pos, nstate, 1|2); if(nstate != state) world.setBlockState(pos, nstate, 1|2);
final double eff = (1.0-((world.getRainStrength(1f)*0.6)+(world.getThunderStrength(1f)*0.3))); final double eff = (1.0-((world.getRainStrength(1f)*0.6)+(world.getThunderStrength(1f)*0.3)));
final double ll = ((double)(world.getLightFor(LightType.SKY, getPos())))/15; final double ll = ((double)(world.getLightFor(LightType.SKY, getPos())))/15;

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorStairs.java * @file EdStairsBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -12,11 +12,11 @@ import wile.engineersdecor.libmc.blocks.StandardStairsBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
public class BlockDecorStairs extends StandardStairsBlock implements IDecorBlock public class EdStairsBlock extends StandardStairsBlock implements IDecorBlock
{ {
public BlockDecorStairs(long config, BlockState state, Block.Properties properties) public EdStairsBlock(long config, BlockState state, Block.Properties properties)
{ super(config, state, properties); } { super(config, state, properties); }
public BlockDecorStairs(long config, java.util.function.Supplier<BlockState> state, Block.Properties properties) public EdStairsBlock(long config, java.util.function.Supplier<BlockState> state, Block.Properties properties)
{ super(config, state, properties); } { super(config, state, properties); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorStraightPole.java * @file EdStraightPoleBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -22,9 +22,9 @@ import net.minecraft.util.math.BlockPos;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorStraightPole extends StandardBlocks.DirectedWaterLoggable implements IDecorBlock, IWaterLoggable public class EdStraightPoleBlock extends StandardBlocks.DirectedWaterLoggable implements IDecorBlock, IWaterLoggable
{ {
public BlockDecorStraightPole(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdStraightPoleBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override
@ -37,7 +37,7 @@ public class BlockDecorStraightPole extends StandardBlocks.DirectedWaterLoggable
if((config & StandardBlocks.CFG_FLIP_PLACEMENT_IF_SAME) != 0) { if((config & StandardBlocks.CFG_FLIP_PLACEMENT_IF_SAME) != 0) {
World world = context.getWorld(); World world = context.getWorld();
BlockPos pos = context.getPos(); BlockPos pos = context.getPos();
if(world.getBlockState(pos.offset(facing.getOpposite())).getBlock() instanceof BlockDecorStraightPole) { if(world.getBlockState(pos.offset(facing.getOpposite())).getBlock() instanceof EdStraightPoleBlock) {
state = state.with(FACING, state.get(FACING).getOpposite()).with(WATERLOGGED, waterlogged); state = state.with(FACING, state.get(FACING).getOpposite()).with(WATERLOGGED, waterlogged);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorTest.java * @file EdTestBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -45,9 +45,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BlockDecorTest extends StandardBlocks.Directed implements IExperimentalFeature, IDecorBlock public class EdTestBlock extends StandardBlocks.Directed implements IExperimentalFeature, IDecorBlock
{ {
public BlockDecorTest(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdTestBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override
@ -61,7 +61,7 @@ public class BlockDecorTest extends StandardBlocks.Directed implements IExperime
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); } { return new TestTileEntity(); }
@Override @Override
public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, @Nullable Direction side) public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, @Nullable Direction side)
@ -85,8 +85,8 @@ public class BlockDecorTest extends StandardBlocks.Directed implements IExperime
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return false; if(!(te instanceof TestTileEntity)) return false;
((BTileEntity)te).activated(player, hand, hit); ((TestTileEntity)te).activated(player, hand, hit);
return true; return true;
} }
@ -94,7 +94,7 @@ public class BlockDecorTest extends StandardBlocks.Directed implements IExperime
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider //, IItemHandler, IEnergyStorage public static class TestTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider //, IItemHandler, IEnergyStorage
{ {
private int tick_interval_ = 10; private int tick_interval_ = 10;
private int passive_tank_capacity_ = 32000; private int passive_tank_capacity_ = 32000;
@ -112,10 +112,10 @@ public class BlockDecorTest extends StandardBlocks.Directed implements IExperime
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
public BTileEntity() public TestTileEntity()
{ this(ModContent.TET_TEST_BLOCK); } { this(ModContent.TET_TEST_BLOCK); }
public BTileEntity(TileEntityType<?> te_type) public TestTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
@ -123,7 +123,7 @@ public class BlockDecorTest extends StandardBlocks.Directed implements IExperime
private Direction block_facing() private Direction block_facing()
{ {
BlockState st = getWorld().getBlockState(getPos()); BlockState st = getWorld().getBlockState(getPos());
return (st.getBlock() instanceof BlockDecorTest) ? st.get(FACING) : Direction.NORTH; return (st.getBlock() instanceof EdTestBlock) ? st.get(FACING) : Direction.NORTH;
} }
private String dump_fluid_stack(FluidStack fs) private String dump_fluid_stack(FluidStack fs)
@ -238,8 +238,8 @@ public class BlockDecorTest extends StandardBlocks.Directed implements IExperime
private static class MainFluidHandler implements IFluidHandler private static class MainFluidHandler implements IFluidHandler
{ {
private BTileEntity te; private TestTileEntity te;
public MainFluidHandler(BTileEntity te) public MainFluidHandler(TestTileEntity te)
{ this.te = te; } { this.te = te; }
@Override public int getTanks() @Override public int getTanks()

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorTreeCutter.java * @file EdTreeCutter.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -42,61 +42,68 @@ import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
public class BlockDecorTreeCutter extends StandardBlocks.Horizontal implements IDecorBlock public class EdTreeCutter
{ {
public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorTreeCutter(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) public static class TreeCutterBlock extends StandardBlocks.Horizontal implements IDecorBlock
{ super(config, builder, unrotatedAABB); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(ACTIVE); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(ACTIVE, false); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{ {
if((state.getBlock()!=this) || (!state.get(ACTIVE))) return; public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
final double rv = rnd.nextDouble();
if(rv > 0.8) return; public TreeCutterBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ(); { super(config, builder, unrotatedAABB); }
final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2);
switch(state.get(HORIZONTAL_FACING)) { @Override
case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break; protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break; { super.fillStateContainer(builder); builder.add(ACTIVE); }
case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break;
default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break; @Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(ACTIVE, false); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new TreeCutterTileEntity(); }
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{
if((state.getBlock()!=this) || (!state.get(ACTIVE))) return;
final double rv = rnd.nextDouble();
if(rv > 0.8) return;
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ();
final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2);
switch(state.get(HORIZONTAL_FACING)) {
case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break;
case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break;
case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break;
default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break;
}
} }
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(te instanceof BTileEntity) ((BTileEntity)te).state_message(player); if(te instanceof TreeCutterTileEntity) ((TreeCutterTileEntity)te).state_message(player);
return true; return true;
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage public static class TreeCutterTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage
{ {
public static final int IDLE_TICK_INTERVAL = 40; public static final int IDLE_TICK_INTERVAL = 40;
public static final int TICK_INTERVAL = 5; public static final int TICK_INTERVAL = 5;
@ -121,10 +128,10 @@ public class BlockDecorTreeCutter extends StandardBlocks.Horizontal implements I
ModEngineersDecor.logger().info("Config tree cutter: Boost energy consumption:" + boost_energy_consumption + "rf/t" + (requires_power?" (power required for operation) ":"") + ", cutting time " + cutting_time_needed + "t." ); ModEngineersDecor.logger().info("Config tree cutter: Boost energy consumption:" + boost_energy_consumption + "rf/t" + (requires_power?" (power required for operation) ":"") + ", cutting time " + cutting_time_needed + "t." );
} }
public BTileEntity() public TreeCutterTileEntity()
{ super(ModContent.TET_SMALL_TREE_CUTTER); } { super(ModContent.TET_SMALL_TREE_CUTTER); }
public BTileEntity(TileEntityType<?> te_type) public TreeCutterTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void readnbt(CompoundNBT nbt) public void readnbt(CompoundNBT nbt)
@ -208,7 +215,7 @@ public class BlockDecorTreeCutter extends StandardBlocks.Horizontal implements I
{ {
if(--tick_timer_ > 0) return; if(--tick_timer_ > 0) return;
if(world.isRemote) { if(world.isRemote) {
if(!world.getBlockState(pos).get(ACTIVE)) { if(!world.getBlockState(pos).get(TreeCutterBlock.ACTIVE)) {
tick_timer_ = TICK_INTERVAL; tick_timer_ = TICK_INTERVAL;
} else { } else {
tick_timer_ = 1; tick_timer_ = 1;
@ -217,10 +224,10 @@ public class BlockDecorTreeCutter extends StandardBlocks.Horizontal implements I
} else { } else {
tick_timer_ = TICK_INTERVAL; tick_timer_ = TICK_INTERVAL;
final BlockState device_state = world.getBlockState(pos); final BlockState device_state = world.getBlockState(pos);
final BlockPos tree_pos = pos.offset(device_state.get(HORIZONTAL_FACING)); final BlockPos tree_pos = pos.offset(device_state.get(TreeCutterBlock.HORIZONTAL_FACING));
final BlockState tree_state = world.getBlockState(tree_pos); final BlockState tree_state = world.getBlockState(tree_pos);
if(!TreeCutting.canChop(tree_state) || (world.isBlockPowered(pos))) { if(!TreeCutting.canChop(tree_state) || (world.isBlockPowered(pos))) {
if(device_state.get(ACTIVE)) world.setBlockState(pos, device_state.with(ACTIVE, false), 1|2); if(device_state.get(TreeCutterBlock.ACTIVE)) world.setBlockState(pos, device_state.with(TreeCutterBlock.ACTIVE, false), 1|2);
proc_time_elapsed_ = 0; proc_time_elapsed_ = 0;
active_timer_ = 0; active_timer_ = 0;
tick_timer_ = IDLE_TICK_INTERVAL; tick_timer_ = IDLE_TICK_INTERVAL;
@ -246,8 +253,8 @@ public class BlockDecorTreeCutter extends StandardBlocks.Horizontal implements I
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_WOOD_BREAK, SoundCategory.BLOCKS, 1.0f, 1.0f); world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_WOOD_BREAK, SoundCategory.BLOCKS, 1.0f, 1.0f);
active = false; active = false;
} }
if(device_state.get(ACTIVE) != active) { if(device_state.get(TreeCutterBlock.ACTIVE) != active) {
world.setBlockState(pos, device_state.with(ACTIVE, active), 1|2); world.setBlockState(pos, device_state.with(TreeCutterBlock.ACTIVE, active), 1|2);
} }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorWall.java * @file EdWallBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -11,8 +11,8 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.VariantWallBlock; import wile.engineersdecor.libmc.blocks.VariantWallBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
public class BlockDecorWall extends VariantWallBlock implements IDecorBlock public class EdWallBlock extends VariantWallBlock implements IDecorBlock
{ {
public BlockDecorWall(long config, Block.Properties builder) public EdWallBlock(long config, Block.Properties builder)
{ super(config, builder); } { super(config, builder); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorWasteIncinerator.java * @file EdWasteIncinerator.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -10,6 +10,7 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.EdFurnace.FurnaceBlock;
import wile.engineersdecor.libmc.blocks.StandardBlocks; import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.libmc.detail.Inventories;
import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.inventory.container.INamedContainerProvider;
@ -60,110 +61,117 @@ import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock implements IDecorBlock public class EdWasteIncinerator
{ {
public static final BooleanProperty LIT = BlockDecorFurnace.DecorFurnaceBlock.LIT; //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorWasteIncinerator(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public static class WasteIncineratorBlock extends StandardBlocks.BaseBlock implements IDecorBlock
{ super(config, builder, unrotatedAABB); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(LIT); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(LIT, false); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorWasteIncinerator.BTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{ {
if(world.isRemote) return; public static final BooleanProperty LIT = FurnaceBlock.LIT;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorWasteIncinerator.BTileEntity)) return;
((BlockDecorWasteIncinerator.BTileEntity)te).readnbt(te_nbt);
((BlockDecorWasteIncinerator.BTileEntity)te).markDirty();
}
@Override public WasteIncineratorBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
public boolean hasDynamicDropList() { super(config, builder, unrotatedAABB); }
{ return true; }
@Override @Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ { super.fillStateContainer(builder); builder.add(LIT); }
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; @Override
final TileEntity te = world.getTileEntity(pos); @Nullable
if(!(te instanceof BTileEntity)) return stacks; public BlockState getStateForPlacement(BlockItemUseContext context)
if(!explosion) { { return super.getStateForPlacement(context).with(LIT, false); }
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((BTileEntity) te).reset_getnbt(); @Override
if(!te_nbt.isEmpty()) { @SuppressWarnings("deprecation")
CompoundNBT nbt = new CompoundNBT(); public boolean hasComparatorInputOverride(BlockState state)
nbt.put("tedata", te_nbt); { return true; }
stack.setTag(nbt);
} @Override
stacks.add(stack); @SuppressWarnings("deprecation")
} else { public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
for(ItemStack stack: ((BTileEntity)te).stacks_) stacks.add(stack); { return Container.calcRedstone(world.getTileEntity(pos)); }
((BTileEntity)te).reset_getnbt();
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new WasteIncineratorTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof WasteIncineratorTileEntity)) return;
((WasteIncineratorTileEntity)te).readnbt(te_nbt);
((WasteIncineratorTileEntity)te).markDirty();
} }
return stacks;
}
@Override @Override
@SuppressWarnings("deprecation") public boolean hasDynamicDropList()
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { return true; }
{
if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return true;
}
@Override @Override
@OnlyIn(Dist.CLIENT) public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd) {
{ final List<ItemStack> stacks = new ArrayList<ItemStack>();
if((state.getBlock()!=this) || (!state.get(LIT))) return; if(world.isRemote) return stacks;
final double rv = rnd.nextDouble(); final TileEntity te = world.getTileEntity(pos);
if(rv > 0.5) return; if(!(te instanceof WasteIncineratorTileEntity)) return stacks;
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ(); if(!explosion) {
final double xr=rnd.nextDouble()*0.4-0.2, yr=rnd.nextDouble()*0.5, zr=rnd.nextDouble()*0.4-0.2; ItemStack stack = new ItemStack(this, 1);
world.addParticle(ParticleTypes.SMOKE, x+xr, y+yr, z+zr, 0.0, 0.0, 0.0); CompoundNBT te_nbt = ((WasteIncineratorTileEntity) te).reset_getnbt();
if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt);
stack.setTag(nbt);
}
stacks.add(stack);
} else {
for(ItemStack stack: ((WasteIncineratorTileEntity)te).stacks_) stacks.add(stack);
((WasteIncineratorTileEntity)te).reset_getnbt();
}
return stacks;
}
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return true;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof WasteIncineratorTileEntity)) return true;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return true;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return true;
}
@Override
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{
if((state.getBlock()!=this) || (!state.get(LIT))) return;
final double rv = rnd.nextDouble();
if(rv > 0.5) return;
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ();
final double xr=rnd.nextDouble()*0.4-0.2, yr=rnd.nextDouble()*0.5, zr=rnd.nextDouble()*0.4-0.2;
world.addParticle(ParticleTypes.SMOKE, x+xr, y+yr, z+zr, 0.0, 0.0, 0.0);
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage public static class WasteIncineratorTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage
{ {
public static final int NUM_OF_FIELDS = 1; public static final int NUM_OF_FIELDS = 1;
public static final int TICK_INTERVAL = 20; public static final int TICK_INTERVAL = 20;
@ -193,10 +201,10 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
private int energy_stored_; private int energy_stored_;
protected NonNullList<ItemStack> stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); protected NonNullList<ItemStack> stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
public BTileEntity() public WasteIncineratorTileEntity()
{ this(ModContent.TET_WASTE_INCINERATOR); } { this(ModContent.TET_WASTE_INCINERATOR); }
public BTileEntity(TileEntityType<?> te_type) public WasteIncineratorTileEntity(TileEntityType<?> te_type)
{ super(te_type); reset(); } { super(te_type); reset(); }
public CompoundNBT reset_getnbt() public CompoundNBT reset_getnbt()
@ -269,7 +277,7 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BlockDecorWasteIncinerator.BContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new WasteIncineratorContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------ // IInventory ------------------------------------------------------------------------------
@ -331,7 +339,7 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(BTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(WasteIncineratorTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
@ -401,9 +409,9 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
protected static class BItemHandler implements IItemHandler protected static class BItemHandler implements IItemHandler
{ {
private BTileEntity te; private WasteIncineratorTileEntity te;
BItemHandler(BTileEntity te) BItemHandler(WasteIncineratorTileEntity te)
{ this.te = te; } { this.te = te; }
@Override @Override
@ -483,7 +491,7 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
// Capability export ---------------------------------------------------------------------------- // Capability export ----------------------------------------------------------------------------
protected LazyOptional<IItemHandler> item_handler_ = LazyOptional.of(() -> new BTileEntity.BItemHandler(this)); protected LazyOptional<IItemHandler> item_handler_ = LazyOptional.of(() -> new WasteIncineratorTileEntity.BItemHandler(this));
protected LazyOptional<IEnergyStorage> energy_handler_ = LazyOptional.of(() -> (IEnergyStorage)this); protected LazyOptional<IEnergyStorage> energy_handler_ = LazyOptional.of(() -> (IEnergyStorage)this);
@Override @Override
@ -536,8 +544,8 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
if((was_processing != is_processing) || (new_stack_processing)) { if((was_processing != is_processing) || (new_stack_processing)) {
if(new_stack_processing) world.playSound(null, pos, SoundEvents.BLOCK_LAVA_AMBIENT, SoundCategory.BLOCKS, 0.05f, 2.4f); if(new_stack_processing) world.playSound(null, pos, SoundEvents.BLOCK_LAVA_AMBIENT, SoundCategory.BLOCKS, 0.05f, 2.4f);
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockDecorWasteIncinerator) { if(state.getBlock() instanceof WasteIncineratorBlock) {
world.setBlockState(pos, state.with(LIT, is_processing), 2|16); world.setBlockState(pos, state.with(WasteIncineratorBlock.LIT, is_processing), 2|16);
} }
} }
if(dirty) markDirty(); if(dirty) markDirty();
@ -592,46 +600,12 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// GUI // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) public static class WasteIncineratorContainer extends Container
public static class BGui extends ContainerScreen<BContainer>
{ {
protected final PlayerEntity player_; private static final int PLAYER_INV_START_SLOTNO = WasteIncineratorTileEntity.NUM_OF_SLOTS;
public BGui(BContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override
public void init()
{ super.init(); }
@Override
public void render(int mouseX, int mouseY, float partialTicks)
{
renderBackground();
super.render(mouseX, mouseY, partialTicks);
renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/small_waste_incinerator_gui.png"));
final int x0=guiLeft, y0=this.guiTop, w=xSize, h=ySize;
blit(x0, y0, 0, 0, w, h);
}
}
//--------------------------------------------------------------------------------------------------------------------
// container
//--------------------------------------------------------------------------------------------------------------------
public static class BContainer extends Container
{
private static final int PLAYER_INV_START_SLOTNO = BTileEntity.NUM_OF_SLOTS;
protected final PlayerEntity player_; protected final PlayerEntity player_;
protected final IInventory inventory_; protected final IInventory inventory_;
protected final IWorldPosCallable wpc_; protected final IWorldPosCallable wpc_;
@ -643,10 +617,10 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
public IInventory inventory() { return inventory_ ; } public IInventory inventory() { return inventory_ ; }
public World world() { return player_.world; } public World world() { return player_.world; }
public BContainer(int cid, PlayerInventory player_inventory) public WasteIncineratorContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(BTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(BTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(WasteIncineratorTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(WasteIncineratorTileEntity.NUM_OF_FIELDS)); }
private BContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private WasteIncineratorContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_WASTE_INCINERATOR, cid); super(ModContent.CT_WASTE_INCINERATOR, cid);
player_ = player_inventory.player; player_ = player_inventory.player;
@ -712,4 +686,38 @@ public class BlockDecorWasteIncinerator extends StandardBlocks.BaseBlock impleme
} }
} }
//--------------------------------------------------------------------------------------------------------------------
// GUI
//--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT)
public static class WasteIncineratorGui extends ContainerScreen<WasteIncineratorContainer>
{
protected final PlayerEntity player_;
public WasteIncineratorGui(WasteIncineratorContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override
public void init()
{ super.init(); }
@Override
public void render(int mouseX, int mouseY, float partialTicks)
{
renderBackground();
super.render(mouseX, mouseY, partialTicks);
renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/small_waste_incinerator_gui.png"));
final int x0=guiLeft, y0=this.guiTop, w=xSize, h=ySize;
blit(x0, y0, 0, 0, w, h);
}
}
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorWindow.java * @file EdWindowBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -20,9 +20,9 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorWindow extends StandardBlocks.DirectedWaterLoggable implements IDecorBlock public class EdWindowBlock extends StandardBlocks.DirectedWaterLoggable implements IDecorBlock
{ {
public BlockDecorWindow(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdWindowBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override
@ -53,5 +53,4 @@ public class BlockDecorWindow extends StandardBlocks.DirectedWaterLoggable imple
} }
return super.getStateForPlacement(context).with(FACING, facing); return super.getStateForPlacement(context).with(FACING, facing);
} }
} }

View file

@ -8,16 +8,8 @@
*/ */
package wile.engineersdecor.blocks; package wile.engineersdecor.blocks;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import wile.engineersdecor.libmc.blocks.StandardBlocks; import wile.engineersdecor.libmc.blocks.StandardBlocks;
import java.util.Collections;
import java.util.List;
public interface IDecorBlock extends StandardBlocks.IStandardBlock public interface IDecorBlock extends StandardBlocks.IStandardBlock
{ {
} }

View file

@ -11,7 +11,7 @@ package wile.engineersdecor.detail;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.registries.ObjectHolder;
public class ExtItems public class ExternalObjects
{ {
@ObjectHolder("immersiveengineering:external_heater") @ObjectHolder("immersiveengineering:external_heater")
public static final Item IE_EXTERNAL_HEATER = null; public static final Item IE_EXTERNAL_HEATER = null;

View file

@ -10,8 +10,8 @@
package wile.engineersdecor.detail; package wile.engineersdecor.detail;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.BlockDecorCraftingTable; import wile.engineersdecor.blocks.EdCraftingTable;
import wile.engineersdecor.blocks.BlockDecorLabeledCrate; import wile.engineersdecor.blocks.EdLabeledCrate;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
@ -20,6 +20,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import wile.engineersdecor.blocks.EdLabeledCrate.LabeledCrateBlock;
public class ModTesrs public class ModTesrs
{ {
@ -28,7 +29,7 @@ public class ModTesrs
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class TesrDecorCraftingTable extends TileEntityRenderer<BlockDecorCraftingTable.CraftingTableTileEntity> public static class TesrDecorCraftingTable extends TileEntityRenderer<EdCraftingTable.CraftingTableTileEntity>
{ {
private static int tesr_error_counter = 4; private static int tesr_error_counter = 4;
private static double scaler = 0.10; private static double scaler = 0.10;
@ -43,11 +44,11 @@ public class ModTesrs
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void render(final BlockDecorCraftingTable.CraftingTableTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) public void render(final EdCraftingTable.CraftingTableTileEntity te, double x, double y, double z, float partialTicks, int destroyStage)
{ {
if(tesr_error_counter<=0) return; if(tesr_error_counter<=0) return;
try { try {
int di = MathHelper.clamp(te.getWorld().getBlockState(te.getPos()).get(BlockDecorCraftingTable.CraftingTableBlock.HORIZONTAL_FACING).getHorizontalIndex(), 0, 3); int di = MathHelper.clamp(te.getWorld().getBlockState(te.getPos()).get(EdCraftingTable.CraftingTableBlock.HORIZONTAL_FACING).getHorizontalIndex(), 0, 3);
long posrnd = te.getPos().toLong(); long posrnd = te.getPos().toLong();
posrnd = (posrnd>>16)^(posrnd<<1); posrnd = (posrnd>>16)^(posrnd<<1);
for(int i=0; i<9; ++i) { for(int i=0; i<9; ++i) {
@ -86,7 +87,7 @@ public class ModTesrs
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class TesrDecorLabeledCrate extends TileEntityRenderer<BlockDecorLabeledCrate.LabeledCrateTileEntity> public static class TesrDecorLabeledCrate extends TileEntityRenderer<EdLabeledCrate.LabeledCrateTileEntity>
{ {
private static int tesr_error_counter = 4; private static int tesr_error_counter = 4;
private static double scaler = 0.35; private static double scaler = 0.35;
@ -99,13 +100,13 @@ public class ModTesrs
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void render(final BlockDecorLabeledCrate.LabeledCrateTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) public void render(final EdLabeledCrate.LabeledCrateTileEntity te, double x, double y, double z, float partialTicks, int destroyStage)
{ {
if(tesr_error_counter<=0) return; if(tesr_error_counter<=0) return;
try { try {
final ItemStack stack = te.getItemFrameStack(); final ItemStack stack = te.getItemFrameStack();
if(stack.isEmpty()) return; if(stack.isEmpty()) return;
final int di = MathHelper.clamp(te.getWorld().getBlockState(te.getPos()).get(BlockDecorLabeledCrate.DecorLabeledCrateBlock.HORIZONTAL_FACING).getHorizontalIndex(), 0, 3); final int di = MathHelper.clamp(te.getWorld().getBlockState(te.getPos()).get(LabeledCrateBlock.HORIZONTAL_FACING).getHorizontalIndex(), 0, 3);
double ox = tr[di][0], oy = tr[di][1], oz = tr[di][2], ry = tr[di][3]; double ox = tr[di][0], oy = tr[di][1], oz = tr[di][2], ry = tr[di][3];
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.disableLighting(); GlStateManager.disableLighting();

View file

@ -9,9 +9,9 @@
package wile.engineersdecor.eapi.jei; package wile.engineersdecor.eapi.jei;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.BlockDecorCraftingTable; import wile.engineersdecor.ModConfig;
import wile.engineersdecor.detail.ModConfig;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.blocks.EdCraftingTable;
import mezz.jei.api.constants.VanillaRecipeCategoryUid; import mezz.jei.api.constants.VanillaRecipeCategoryUid;
import mezz.jei.api.registration.IRecipeTransferRegistration; import mezz.jei.api.registration.IRecipeTransferRegistration;
import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.constants.VanillaTypes;
@ -35,7 +35,7 @@ public class JEIPlugin implements mezz.jei.api.IModPlugin
if(!ModConfig.without_crafting_table) { if(!ModConfig.without_crafting_table) {
try { try {
registration.addRecipeTransferHandler( registration.addRecipeTransferHandler(
BlockDecorCraftingTable.CraftingTableContainer.class, EdCraftingTable.CraftingTableContainer.class,
VanillaRecipeCategoryUid.CRAFTING, VanillaRecipeCategoryUid.CRAFTING,
1, 9, 10, 44 1, 9, 10, 44
); );

View file

@ -10,29 +10,25 @@
package wile.engineersdecor.libmc.blocks; package wile.engineersdecor.libmc.blocks;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.item.*;
import net.minecraft.util.math.*;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState; import net.minecraft.fluid.IFluidState;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IntegerProperty; import net.minecraft.state.IntegerProperty;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -115,9 +111,39 @@ public class SlabSliceBlock extends StandardBlocks.WaterLoggable implements Stan
@Nullable @Nullable
public BlockState getStateForPlacement(BlockItemUseContext context) public BlockState getStateForPlacement(BlockItemUseContext context)
{ {
final Direction facing = context.getFace(); final BlockPos pos = context.getPos();
double y = context.getHitVec().getY(); BlockState state = context.getWorld().getBlockState(pos);
return super.getStateForPlacement(context).with(PARTS, ((facing==Direction.UP) || ((facing!=Direction.DOWN) && (y < 0.6))) ? 0 : 14); if(state.getBlock() == this) {
int parts = state.get(PARTS);
if(parts == 7) return null; // -> is already a full block.
parts += (parts < 7) ? 1 : -1;
if(parts==7) state = state.with(WATERLOGGED, false);
return state.with(PARTS, parts);
} else {
final Direction face = context.getFace();
final BlockState placement_state = super.getStateForPlacement(context); // fluid state
if(face == Direction.UP) return placement_state.with(PARTS, 0);
if(face == Direction.DOWN) return placement_state.with(PARTS, 14);
if(!face.getAxis().isHorizontal()) return placement_state;
final boolean isupper = ((context.getHitVec().getY() - context.getPos().getY()) > 0.5);
return placement_state.with(PARTS, isupper ? 14 : 0);
}
}
@Override
@SuppressWarnings("deprecation")
public boolean isReplaceable(BlockState state, BlockItemUseContext context)
{
if(context.getItem().getItem() != this.asItem()) return false;
if(!context.replacingClickedOnBlock()) return true;
final Direction face = context.getFace();
final int parts = state.get(PARTS);
if(parts == 7) return false;
if((face == Direction.UP) && (parts < 7)) return true;
if((face == Direction.DOWN) && (parts > 7)) return true;
if(!face.getAxis().isHorizontal()) return false;
final boolean isupper = ((context.getHitVec().getY() - context.getPos().getY()) > 0.5);
return isupper ? (parts==0) : (parts==1);
} }
@Override @Override
@ -138,32 +164,6 @@ public class SlabSliceBlock extends StandardBlocks.WaterLoggable implements Stan
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
{ return new ArrayList<ItemStack>(Collections.singletonList(new ItemStack(this.asItem(), num_slabs_contained_in_parts_[state.get(PARTS) & 0xf]))); } { return new ArrayList<ItemStack>(Collections.singletonList(new ItemStack(this.asItem(), num_slabs_contained_in_parts_[state.get(PARTS) & 0xf]))); }
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
Direction face = rayTraceResult.getFace();
final ItemStack stack = player.getHeldItem(hand);
if(stack.isEmpty() || (Block.getBlockFromItem(stack.getItem()) != this)) return false;
if((face != Direction.UP) && (face != Direction.DOWN)) return false;
int parts = state.get(PARTS);
if((face != Direction.UP) && (parts > 7)) {
world.setBlockState(pos, state.with(PARTS, parts-1), 3);
} else if((face != Direction.DOWN) && (parts < 7)) {
world.setBlockState(pos, state.with(PARTS, parts+1), 3);
} else {
return (parts != 7);
}
if(world.isRemote) return true;
if(!player.isCreative()) {
stack.shrink(1);
if(player.inventory != null) player.inventory.markDirty();
}
SoundType st = this.getSoundType(state, world, pos, null);
world.playSound(null, pos, st.getPlaceSound(), SoundCategory.BLOCKS, (st.getVolume()+1f)/2.5f, 0.9f*st.getPitch());
return true;
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void onBlockClicked(BlockState state, World world, BlockPos pos, PlayerEntity player) public void onBlockClicked(BlockState state, World world, BlockPos pos, PlayerEntity player)

View file

@ -13,6 +13,8 @@
package wile.engineersdecor.libmc.blocks; package wile.engineersdecor.libmc.blocks;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.state.DirectionProperty; import net.minecraft.state.DirectionProperty;
@ -71,6 +73,12 @@ public class StandardBlocks
{ return Collections.singletonList((!world.isRemote()) ? (new ItemStack(state.getBlock().asItem())) : (ItemStack.EMPTY)); } { return Collections.singletonList((!world.isRemote()) ? (new ItemStack(state.getBlock().asItem())) : (ItemStack.EMPTY)); }
} }
public interface IBlockItemFactory
{
// BlockItem factory for item registry. Only invoked once.
BlockItem getBlockItem(Block blockIn, Item.Properties builder);
}
public static class BaseBlock extends Block implements IStandardBlock public static class BaseBlock extends Block implements IStandardBlock
{ {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;

View file

@ -5,4 +5,4 @@ version_minecraft=1.15.2
version_forge_minecraft=1.15.2-31.1.44 version_forge_minecraft=1.15.2-31.1.44
version_fml_mappings=20200225-1.15.1 version_fml_mappings=20200225-1.15.1
version_jei=1.15.2:6.0.0.2 version_jei=1.15.2:6.0.0.2
version_engineersdecor=1.0.20-b5 version_engineersdecor=1.0.20-b6

View file

@ -1,6 +1,7 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.15.2": { "1.15.2": {
"1.0.20-b6": "[M] Slab Slice placement improved.\n[M] Quite some naming/refractoring under the hood.",
"1.0.20-b5": "[A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a Hopper is placed in the auxiliary slot.\n[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.", "1.0.20-b5": "[A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a Hopper is placed in the auxiliary slot.\n[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.",
"1.0.20-b4": "[F] Fixed Mineral Smelter fluid voiding on external draining (issue #92, thx papaworld, pupnewfster).", "1.0.20-b4": "[F] Fixed Mineral Smelter fluid voiding on external draining (issue #92, thx papaworld, pupnewfster).",
"1.0.20-b3": "[M] Labeled Crate: GUI quick-move-all (ctrl-shift click) smart move tweaked, Manual page added.\n[F] Fixed IE ingredients based default recipes for Factory Dropper and Small Electrical Furnace.\n[M] Factory Hopper: GUI quick-move-all added.\n[M] Code structure, simplifications, cap invalidation fixes.\n[M] Valves: Removed performance caching for testing purposes.", "1.0.20-b3": "[M] Labeled Crate: GUI quick-move-all (ctrl-shift click) smart move tweaked, Manual page added.\n[F] Fixed IE ingredients based default recipes for Factory Dropper and Small Electrical Furnace.\n[M] Factory Hopper: GUI quick-move-all added.\n[M] Code structure, simplifications, cap invalidation fixes.\n[M] Valves: Removed performance caching for testing purposes.",
@ -19,6 +20,6 @@
}, },
"promos": { "promos": {
"1.15.2-recommended": "", "1.15.2-recommended": "",
"1.15.2-latest": "1.0.20-b5" "1.15.2-latest": "1.0.20-b6"
} }
} }

View file

@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.15.1.
## Version history ## Version history
- v1.0.20-b6 [M] Slab Slice placement improved.
[M] Quite some naming/refractoring under the hood.
- v1.0.20-b5 [A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a - v1.0.20-b5 [A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a
Hopper is placed in the auxiliary slot. Hopper is placed in the auxiliary slot.
[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label. [M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.

View file

@ -7,10 +7,8 @@
* Main class for module settings. Handles reading and * Main class for module settings. Handles reading and
* saving the config file. * saving the config file.
*/ */
package wile.engineersdecor.detail; package wile.engineersdecor;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.blocks.*; import wile.engineersdecor.blocks.*;
import wile.engineersdecor.libmc.blocks.StandardBlocks; import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
@ -416,14 +414,14 @@ public class ModConfig
.comment("Defines, in percent, how fast the electrical furnace smelts compared to " + .comment("Defines, in percent, how fast the electrical furnace smelts compared to " +
"a vanilla furnace. 100% means vanilla furnace speed, 150% means the " + "a vanilla furnace. 100% means vanilla furnace speed, 150% means the " +
"electrical furnace is faster. The value can be changed on-the-fly for tuning.") "electrical furnace is faster. The value can be changed on-the-fly for tuning.")
.defineInRange("e_furnace_speed_percent", BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity.DEFAULT_SPEED_PERCENT, 50, 800); .defineInRange("e_furnace_speed_percent", EdElectricalFurnace.ElectricalFurnaceTileEntity.DEFAULT_SPEED_PERCENT, 50, 800);
e_furnace_power_consumption = builder e_furnace_power_consumption = builder
.translation(ModEngineersDecor.MODID + ".config.e_furnace_power_consumption") .translation(ModEngineersDecor.MODID + ".config.e_furnace_power_consumption")
.comment("Defines how much RF per tick the the electrical furnace consumed (average) for smelting. " + .comment("Defines how much RF per tick the the electrical furnace consumed (average) for smelting. " +
"The feeders transferring items from/to adjacent have this consumption/8 for each stack transaction. " + "The feeders transferring items from/to adjacent have this consumption/8 for each stack transaction. " +
"The default value is only slightly higher than a furnace with an IE external heater (and no burning fuel inside)." + "The default value is only slightly higher than a furnace with an IE external heater (and no burning fuel inside)." +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("e_furnace_power_consumption", BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity.DEFAULT_ENERGY_CONSUMPTION, 8, 4096); .defineInRange("e_furnace_power_consumption", EdElectricalFurnace.ElectricalFurnaceTileEntity.DEFAULT_ENERGY_CONSUMPTION, 8, 4096);
e_furnace_automatic_pulling = builder e_furnace_automatic_pulling = builder
.translation(ModEngineersDecor.MODID + ".config.e_furnace_automatic_pulling") .translation(ModEngineersDecor.MODID + ".config.e_furnace_automatic_pulling")
.comment("Defines if the electrical furnace automatically pulls items from an inventory at the input side." + .comment("Defines if the electrical furnace automatically pulls items from an inventory at the input side." +
@ -435,24 +433,24 @@ public class ModConfig
"Note that the agerage power is much less, as no power is produced at all during the night, " + "Note that the agerage power is much less, as no power is produced at all during the night, " +
"and the power curve is nonlinear rising/falling during the day. Bad weather conditions also " + "and the power curve is nonlinear rising/falling during the day. Bad weather conditions also " +
"decrease the production. The config value can be changed on-the-fly for tuning.") "decrease the production. The config value can be changed on-the-fly for tuning.")
.defineInRange("small_solar_panel_peak_production", BlockDecorSolarPanel.BTileEntity.DEFAULT_PEAK_POWER, 2, 4096); .defineInRange("small_solar_panel_peak_production", EdSolarPanel.SolarPanelTileEntity.DEFAULT_PEAK_POWER, 2, 4096);
block_breaker_power_consumption = builder block_breaker_power_consumption = builder
.translation(ModEngineersDecor.MODID + ".config.block_breaker_power_consumption") .translation(ModEngineersDecor.MODID + ".config.block_breaker_power_consumption")
.comment("Defines how much RF power the Small Block Breaker requires to magnificently increase the processing speed. " + .comment("Defines how much RF power the Small Block Breaker requires to magnificently increase the processing speed. " +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("block_breaker_power_consumption", BlockDecorBreaker.BTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024); .defineInRange("block_breaker_power_consumption", EdBreaker.BreakerTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024);
block_breaker_reluctance = builder block_breaker_reluctance = builder
.translation(ModEngineersDecor.MODID + ".config.block_breaker_reluctance") .translation(ModEngineersDecor.MODID + ".config.block_breaker_reluctance")
.comment("Defines how much time the Small Block Breaker needs per block hardness, " + .comment("Defines how much time the Small Block Breaker needs per block hardness, " +
"means: 'reluctance' * hardness + min_time, you change the 'reluctance' here." + "means: 'reluctance' * hardness + min_time, you change the 'reluctance' here." +
"The unit is ticks/hardness. " + "The config value can be changed on-the-fly for tuning.") "The unit is ticks/hardness. " + "The config value can be changed on-the-fly for tuning.")
.defineInRange("block_breaker_reluctance", BlockDecorBreaker.BTileEntity.DEFAULT_BREAKING_RELUCTANCE, 5, 50); .defineInRange("block_breaker_reluctance", EdBreaker.BreakerTileEntity.DEFAULT_BREAKING_RELUCTANCE, 5, 50);
block_breaker_min_breaking_time = builder block_breaker_min_breaking_time = builder
.translation(ModEngineersDecor.MODID + ".config.block_breaker_min_breaking_time") .translation(ModEngineersDecor.MODID + ".config.block_breaker_min_breaking_time")
.comment("Defines how much time the Small Block Breaker needs at least, better said it's an offset: " + .comment("Defines how much time the Small Block Breaker needs at least, better said it's an offset: " +
"'reluctance' * hardness + min_time, you change the 'min_time' here, value " + "'reluctance' * hardness + min_time, you change the 'min_time' here, value " +
"in ticks." + "The config value can be changed on-the-fly for tuning.") "in ticks." + "The config value can be changed on-the-fly for tuning.")
.defineInRange("block_breaker_min_breaking_time", BlockDecorBreaker.BTileEntity.DEFAULT_MIN_BREAKING_TIME, 10, 100); .defineInRange("block_breaker_min_breaking_time", EdBreaker.BreakerTileEntity.DEFAULT_MIN_BREAKING_TIME, 10, 100);
block_breaker_requires_power = builder block_breaker_requires_power = builder
.translation(ModEngineersDecor.MODID + ".config.block_breaker_requires_power") .translation(ModEngineersDecor.MODID + ".config.block_breaker_requires_power")
.comment("Defines if the Small Block Breaker does not work without RF power.") .comment("Defines if the Small Block Breaker does not work without RF power.")
@ -461,13 +459,13 @@ public class ModConfig
.translation(ModEngineersDecor.MODID + ".config.tree_cuttter_energy_consumption") .translation(ModEngineersDecor.MODID + ".config.tree_cuttter_energy_consumption")
.comment("Defines how much RF power the Small Tree Cutter requires to magnificently increase the processing speed. " + .comment("Defines how much RF power the Small Tree Cutter requires to magnificently increase the processing speed. " +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("tree_cuttter_energy_consumption", BlockDecorTreeCutter.BTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024); .defineInRange("tree_cuttter_energy_consumption", EdTreeCutter.TreeCutterTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024);
tree_cuttter_cutting_time_needed = builder tree_cuttter_cutting_time_needed = builder
.translation(ModEngineersDecor.MODID + ".config.tree_cuttter_cutting_time_needed") .translation(ModEngineersDecor.MODID + ".config.tree_cuttter_cutting_time_needed")
.comment("Defines how much time the Small Tree Cutter needs to cut a tree without RF power. " + .comment("Defines how much time the Small Tree Cutter needs to cut a tree without RF power. " +
"The value is in seconds. With energy it is 6 times faster. " + "The value is in seconds. With energy it is 6 times faster. " +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("tree_cuttter_cutting_time_needed", BlockDecorTreeCutter.BTileEntity.DEFAULT_CUTTING_TIME_NEEDED, 10, 240); .defineInRange("tree_cuttter_cutting_time_needed", EdTreeCutter.TreeCutterTileEntity.DEFAULT_CUTTING_TIME_NEEDED, 10, 240);
tree_cuttter_requires_power = builder tree_cuttter_requires_power = builder
.translation(ModEngineersDecor.MODID + ".config.tree_cuttter_requires_power") .translation(ModEngineersDecor.MODID + ".config.tree_cuttter_requires_power")
.comment("Defines if the Small Tree Cutter does not work without RF power.") .comment("Defines if the Small Tree Cutter does not work without RF power.")
@ -478,11 +476,11 @@ public class ModConfig
"Note this is a permanent standby power, not only when the device does something. " + "Note this is a permanent standby power, not only when the device does something. " +
"Use zero to disable energy dependency and energy handling of the machine. " + "Use zero to disable energy dependency and energy handling of the machine. " +
"The config value can be changed on-the-fly for tuning.") "The config value can be changed on-the-fly for tuning.")
.defineInRange("milking_machine_energy_consumption", BlockDecorMilker.BTileEntity.DEFAULT_ENERGY_CONSUMPTION, 0, 1024); .defineInRange("milking_machine_energy_consumption", EdMilker.MilkerTileEntity.DEFAULT_ENERGY_CONSUMPTION, 0, 1024);
milking_machine_milking_delay = builder milking_machine_milking_delay = builder
.translation(ModEngineersDecor.MODID + ".config.milking_machine_milking_delay") .translation(ModEngineersDecor.MODID + ".config.milking_machine_milking_delay")
.comment("Defines (for each individual cow) the minimum time between milking." ) .comment("Defines (for each individual cow) the minimum time between milking." )
.defineInRange("milking_machine_milking_delay", BlockDecorMilker.BTileEntity.DEFAULT_MILKING_DELAY_PER_COW, 1000, 24000); .defineInRange("milking_machine_milking_delay", EdMilker.MilkerTileEntity.DEFAULT_MILKING_DELAY_PER_COW, 1000, 24000);
builder.pop(); builder.pop();
} }
} }
@ -509,8 +507,8 @@ public class ModConfig
// Hard IE dependent blocks // Hard IE dependent blocks
if(!immersiveengineering_installed) { if(!immersiveengineering_installed) {
if(block == ModContent.CONCRETE_WALL) return true; if(block == ModContent.CONCRETE_WALL) return true;
if((block instanceof BlockDecor) && ((((BlockDecor)block).config & BlockDecor.CFG_HARD_IE_DEPENDENT) != 0)) return true; if((block instanceof DecorBlock.Normal) && ((((DecorBlock.Normal)block).config & DecorBlock.CFG_HARD_IE_DEPENDENT) != 0)) return true;
if((block instanceof StandardBlocks.BaseBlock) && ((((StandardBlocks.BaseBlock)block).config & BlockDecor.CFG_HARD_IE_DEPENDENT) != 0)) return true; if((block instanceof StandardBlocks.BaseBlock) && ((((StandardBlocks.BaseBlock)block).config & DecorBlock.CFG_HARD_IE_DEPENDENT) != 0)) return true;
} }
// Force-include/exclude pattern matching // Force-include/exclude pattern matching
try { try {
@ -532,31 +530,31 @@ public class ModConfig
excludes_.clear(); excludes_.clear();
} }
// Early non-opt out type based evaluation // Early non-opt out type based evaluation
if(block instanceof BlockDecorCraftingTable.CraftingTableBlock) return COMMON.without_crafting_table.get(); if(block instanceof EdCraftingTable.CraftingTableBlock) return COMMON.without_crafting_table.get();
if(block instanceof BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock) return COMMON.without_electrical_furnace.get(); if(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock) return COMMON.without_electrical_furnace.get();
if((block instanceof BlockDecorFurnace.DecorFurnaceBlock) && (!(block instanceof BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock))) return COMMON.without_lab_furnace.get(); if((block instanceof EdFurnace.FurnaceBlock) && (!(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock))) return COMMON.without_lab_furnace.get();
if(block instanceof BlockDecorPassiveFluidAccumulator) return COMMON.without_passive_fluid_accumulator.get(); if(block instanceof EdFluidAccumulator.FluidAccumulatorBlock) return COMMON.without_passive_fluid_accumulator.get();
if(block instanceof BlockDecorWasteIncinerator) return COMMON.without_waste_incinerator.get(); if(block instanceof EdWasteIncinerator.WasteIncineratorBlock) return COMMON.without_waste_incinerator.get();
if(block instanceof BlockDecorDropper) return COMMON.without_factory_dropper.get(); if(block instanceof EdDropper.DropperBlock) return COMMON.without_factory_dropper.get();
if(block instanceof BlockDecorPlacer) return COMMON.without_factory_placer.get(); if(block instanceof EdPlacer.PlacerBlock) return COMMON.without_factory_placer.get();
if(block instanceof BlockDecorBreaker) return COMMON.without_block_breaker.get(); if(block instanceof EdBreaker.BreakerBlock) return COMMON.without_block_breaker.get();
if(block instanceof BlockDecorHalfSlab) return COMMON.without_halfslabs.get(); if(block instanceof EdSlabSliceBlock) return COMMON.without_halfslabs.get();
if(block instanceof BlockDecorLadder) return COMMON.without_ladders.get(); if(block instanceof EdLadderBlock) return COMMON.without_ladders.get();
if(block instanceof BlockDecorWindow) return COMMON.without_windows.get(); if(block instanceof EdWindowBlock) return COMMON.without_windows.get();
if(block instanceof BlockDecorPipeValve.DecorPipeValveBlock) return COMMON.without_valves.get(); if(block instanceof EdPipeValve.PipeValveBlock) return COMMON.without_valves.get();
if(block instanceof BlockDecorHorizontalSupport) return COMMON.without_hsupports.get(); if(block instanceof EdHorizontalSupportBlock) return COMMON.without_hsupports.get();
if(block instanceof BlockDecorFloorGrating) return COMMON.without_floor_grating.get(); if(block instanceof EdFloorGratingBlock) return COMMON.without_floor_grating.get();
if(block instanceof BlockDecorHopper.DecorHopperBlock) return COMMON.without_factory_hopper.get(); if(block instanceof EdHopper.HopperBlock) return COMMON.without_factory_hopper.get();
if(block instanceof BlockDecorFluidFunnel) return COMMON.without_fluid_funnel.get(); if(block instanceof EdFluidFunnel.FluidFunnelBlock) return COMMON.without_fluid_funnel.get();
if(block instanceof BlockDecorSolarPanel) return COMMON.without_solar_panel.get(); if(block instanceof EdSolarPanel.SolarPanelBlock) return COMMON.without_solar_panel.get();
if(block instanceof BlockDecorMineralSmelter.DecorMineralSmelterBlock) return COMMON.without_mineral_smelter.get(); if(block instanceof EdMineralSmelter.MineralSmelterBlock) return COMMON.without_mineral_smelter.get();
if(block instanceof BlockDecorMilker) return COMMON.without_milking_machine.get(); if(block instanceof EdMilker.MilkerBlock) return COMMON.without_milking_machine.get();
if(block instanceof BlockDecorTreeCutter) return COMMON.without_tree_cutter.get(); if(block instanceof EdTreeCutter.TreeCutterBlock) return COMMON.without_tree_cutter.get();
// Type based evaluation where later filters may match, too // Type based evaluation where later filters may match, too
if(COMMON.without_slabs.get() && (block instanceof BlockDecorSlab)) return true; if(COMMON.without_slabs.get() && (block instanceof EdSlabBlock)) return true;
if(COMMON.without_stairs.get() && (block instanceof BlockDecorStairs)) return true; if(COMMON.without_stairs.get() && (block instanceof EdStairsBlock)) return true;
if(COMMON.without_walls.get() && (block instanceof BlockDecorWall)) return true; if(COMMON.without_walls.get() && (block instanceof EdWallBlock)) return true;
if(COMMON.without_poles.get() && (block instanceof BlockDecorStraightPole)) return true; if(COMMON.without_poles.get() && (block instanceof EdStraightPoleBlock)) return true;
// String matching based evaluation // String matching based evaluation
if(COMMON.without_clinker_bricks.get() && (rn.startsWith("clinker_brick_"))) return true; if(COMMON.without_clinker_bricks.get() && (rn.startsWith("clinker_brick_"))) return true;
if(COMMON.without_slag_bricks.get() && rn.startsWith("slag_brick_")) return true; if(COMMON.without_slag_bricks.get() && rn.startsWith("slag_brick_")) return true;
@ -566,7 +564,7 @@ public class ModConfig
if(COMMON.without_light_sources.get() && rn.endsWith("_light")) return true; if(COMMON.without_light_sources.get() && rn.endsWith("_light")) return true;
if(COMMON.without_sign_plates.get() && rn.startsWith("sign_")) return true; if(COMMON.without_sign_plates.get() && rn.startsWith("sign_")) return true;
if(COMMON.without_treated_wood_furniture.get()) { if(COMMON.without_treated_wood_furniture.get()) {
if(block instanceof BlockDecorChair) return true; if(block instanceof EdChair.ChairBlock) return true;
if(rn.equals("treated_wood_table")) return true; if(rn.equals("treated_wood_table")) return true;
if(rn.equals("treated_wood_stool")) return true; if(rn.equals("treated_wood_stool")) return true;
if(rn.equals("treated_wood_windowsill")) return true; if(rn.equals("treated_wood_windowsill")) return true;
@ -614,19 +612,19 @@ public class ModConfig
without_recipes_ = COMMON.without_recipes.get(); without_recipes_ = COMMON.without_recipes.get();
without_direct_slab_pickup = COMMON.without_direct_slab_pickup.get(); without_direct_slab_pickup = COMMON.without_direct_slab_pickup.get();
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
BlockDecorFurnace.DecorFurnaceTileEntity.on_config(COMMON.furnace_smelting_speed_percent.get(), COMMON.furnace_fuel_efficiency_percent.get(), COMMON.furnace_boost_energy_consumption.get()); EdFurnace.FurnaceTileEntity.on_config(COMMON.furnace_smelting_speed_percent.get(), COMMON.furnace_fuel_efficiency_percent.get(), COMMON.furnace_boost_energy_consumption.get());
BlockDecorChair.on_config(COMMON.without_chair_sitting.get(), COMMON.without_mob_chair_sitting.get(), COMMON.chair_mob_sitting_probability_percent.get(), COMMON.chair_mob_standup_probability_percent.get()); EdChair.on_config(COMMON.without_chair_sitting.get(), COMMON.without_mob_chair_sitting.get(), COMMON.chair_mob_sitting_probability_percent.get(), COMMON.chair_mob_standup_probability_percent.get());
BlockDecorLadder.on_config(COMMON.without_ladder_speed_boost.get()); EdLadderBlock.on_config(COMMON.without_ladder_speed_boost.get());
BlockDecorCraftingTable.on_config(COMMON.without_crafting_table_history.get(), false, COMMON.with_crafting_quickmove_buttons.get(), COMMON.without_crafting_mouse_scrolling.get()); EdCraftingTable.on_config(COMMON.without_crafting_table_history.get(), false, COMMON.with_crafting_quickmove_buttons.get(), COMMON.without_crafting_mouse_scrolling.get());
BlockDecorPipeValve.on_config(COMMON.pipevalve_max_flowrate.get(), COMMON.pipevalve_redstone_gain.get()); EdPipeValve.on_config(COMMON.pipevalve_max_flowrate.get(), COMMON.pipevalve_redstone_gain.get());
BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity.on_config(COMMON.e_furnace_speed_percent.get(), COMMON.e_furnace_power_consumption.get(), COMMON.e_furnace_automatic_pulling.get()); EdElectricalFurnace.ElectricalFurnaceTileEntity.on_config(COMMON.e_furnace_speed_percent.get(), COMMON.e_furnace_power_consumption.get(), COMMON.e_furnace_automatic_pulling.get());
BlockDecorSolarPanel.BTileEntity.on_config(COMMON.small_solar_panel_peak_production.get()); EdSolarPanel.SolarPanelTileEntity.on_config(COMMON.small_solar_panel_peak_production.get());
BlockDecorBreaker.BTileEntity.on_config(COMMON.block_breaker_power_consumption.get(), COMMON.block_breaker_reluctance.get(), COMMON.block_breaker_min_breaking_time.get(), COMMON.block_breaker_requires_power.get()); EdBreaker.BreakerTileEntity.on_config(COMMON.block_breaker_power_consumption.get(), COMMON.block_breaker_reluctance.get(), COMMON.block_breaker_min_breaking_time.get(), COMMON.block_breaker_requires_power.get());
BlockDecorTreeCutter.BTileEntity.on_config(COMMON.tree_cuttter_energy_consumption.get(), COMMON.tree_cuttter_cutting_time_needed.get(), COMMON.tree_cuttter_requires_power.get()); EdTreeCutter.TreeCutterTileEntity.on_config(COMMON.tree_cuttter_energy_consumption.get(), COMMON.tree_cuttter_cutting_time_needed.get(), COMMON.tree_cuttter_requires_power.get());
BlockDecorMilker.BTileEntity.on_config(COMMON.milking_machine_energy_consumption.get(), COMMON.milking_machine_milking_delay.get()); EdMilker.MilkerTileEntity.on_config(COMMON.milking_machine_energy_consumption.get(), COMMON.milking_machine_milking_delay.get());
BlockDecorSlab.on_config(!COMMON.without_direct_slab_pickup.get()); EdSlabBlock.on_config(!COMMON.without_direct_slab_pickup.get());
BlockDecorHalfSlab.on_config(!COMMON.without_direct_slab_pickup.get()); EdSlabSliceBlock.on_config(!COMMON.without_direct_slab_pickup.get());
BlockDecorLabeledCrate.on_config(false); EdLabeledCrate.on_config(false);
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
if(with_experimental_features_) { if(with_experimental_features_) {
ModEngineersDecor.logger().info("Config: EXPERIMENTAL FEATURES ENABLED."); ModEngineersDecor.logger().info("Config: EXPERIMENTAL FEATURES ENABLED.");

View file

@ -13,6 +13,11 @@
package wile.engineersdecor; package wile.engineersdecor;
import wile.engineersdecor.blocks.*; import wile.engineersdecor.blocks.*;
import wile.engineersdecor.blocks.EdFurnace.FurnaceBlock;
import wile.engineersdecor.blocks.EdFurnace.FurnaceContainer;
import wile.engineersdecor.blocks.EdFurnace.FurnaceGui;
import wile.engineersdecor.blocks.EdFurnace.FurnaceTileEntity;
import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.libmc.blocks.StandardBlocks.IStandardBlock; import wile.engineersdecor.libmc.blocks.StandardBlocks.IStandardBlock;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.block.material.MaterialColor; import net.minecraft.block.material.MaterialColor;
@ -54,181 +59,181 @@ public class ModContent
// Blocks // Blocks
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static final BlockDecor CLINKER_BRICK_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal CLINKER_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_block"));
public static final BlockDecorSlab CLINKER_BRICK_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock CLINKER_BRICK_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_slab"));
public static final BlockDecorStairs CLINKER_BRICK_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock CLINKER_BRICK_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
CLINKER_BRICK_BLOCK.getDefaultState(), CLINKER_BRICK_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stairs"));
public static final BlockDecorWall CLINKER_BRICK_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock CLINKER_BRICK_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_wall"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor CLINKER_BRICK_STAINED_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal CLINKER_BRICK_STAINED_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_block"));
public static final BlockDecorSlab CLINKER_BRICK_STAINED_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock CLINKER_BRICK_STAINED_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_slab"));
public static final BlockDecorStairs CLINKER_BRICK_STAINED_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock CLINKER_BRICK_STAINED_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
CLINKER_BRICK_BLOCK.getDefaultState(), CLINKER_BRICK_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_stairs"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor SLAG_BRICK_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal SLAG_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_block"));
public static final BlockDecorSlab SLAG_BRICK_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock SLAG_BRICK_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_slab"));
public static final BlockDecorStairs SLAG_BRICK_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock SLAG_BRICK_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
SLAG_BRICK_BLOCK.getDefaultState(), SLAG_BRICK_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_stairs"));
public static final BlockDecorWall SLAG_BRICK_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock SLAG_BRICK_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "slag_brick_wall"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor REBAR_CONCRETE_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal REBAR_CONCRETE_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete"));
public static final BlockDecorSlab REBAR_CONCRETE_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock REBAR_CONCRETE_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_slab"));
public static final BlockDecorStairs REBAR_CONCRETE_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock REBAR_CONCRETE_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
REBAR_CONCRETE_BLOCK.getDefaultState(), REBAR_CONCRETE_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_stairs"));
public static final BlockDecorWall REBAR_CONCRETE_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock REBAR_CONCRETE_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_wall"));
public static final BlockDecorHalfSlab HALFSLAB_REBARCONCRETE = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_REBARCONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_rebar_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_rebar_concrete"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor GAS_CONCRETE_BLOCK = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal GAS_CONCRETE_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete"));
public static final BlockDecorSlab GAS_CONCRETE_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock GAS_CONCRETE_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_slab"));
public static final BlockDecorStairs GAS_CONCRETE_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock GAS_CONCRETE_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
REBAR_CONCRETE_BLOCK.getDefaultState(), REBAR_CONCRETE_BLOCK.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_stairs"));
public static final BlockDecorWall GAS_CONCRETE_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock GAS_CONCRETE_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "gas_concrete_wall"));
public static final BlockDecorHalfSlab HALFSLAB_GASCONCRETE = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_GASCONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_gas_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_gas_concrete"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor REBAR_CONCRETE_TILE = (BlockDecor)(new BlockDecor( public static final DecorBlock.Normal REBAR_CONCRETE_TILE = (DecorBlock.Normal)(new DecorBlock.Normal(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile"));
public static final BlockDecorSlab REBAR_CONCRETE_TILE_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock REBAR_CONCRETE_TILE_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile_slab"));
public static final BlockDecorStairs REBAR_CONCRETE_TILE_STAIRS = (BlockDecorStairs)(new BlockDecorStairs( public static final EdStairsBlock REBAR_CONCRETE_TILE_STAIRS = (EdStairsBlock)(new EdStairsBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
REBAR_CONCRETE_TILE.getDefaultState(), REBAR_CONCRETE_TILE.getDefaultState(),
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE) Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile_stairs")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "rebar_concrete_tile_stairs"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorGlassBlock PANZERGLASS_BLOCK = (BlockDecorGlassBlock)(new BlockDecorGlassBlock( public static final EdGlassBlock PANZERGLASS_BLOCK = (EdGlassBlock)(new EdGlassBlock(
BlockDecor.CFG_TRANSLUCENT, DecorBlock.CFG_TRANSLUCENT,
Block.Properties.create(Material.GLASS, MaterialColor.AIR).hardnessAndResistance(5f, 2000f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.GLASS, MaterialColor.AIR).hardnessAndResistance(5f, 2000f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "panzerglass_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "panzerglass_block"));
public static final BlockDecorSlab PANZERGLASS_SLAB = (BlockDecorSlab)(new BlockDecorSlab( public static final EdSlabBlock PANZERGLASS_SLAB = (EdSlabBlock)(new EdSlabBlock(
BlockDecor.CFG_TRANSLUCENT, DecorBlock.CFG_TRANSLUCENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5f, 2000f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5f, 2000f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "panzerglass_slab")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "panzerglass_slab"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorLadder METAL_RUNG_LADDER = (BlockDecorLadder)(new BlockDecorLadder( public static final EdLadderBlock METAL_RUNG_LADDER = (EdLadderBlock)(new EdLadderBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 25f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 25f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_rung_ladder")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_rung_ladder"));
public static final BlockDecorLadder METAL_RUNG_STEPS = (BlockDecorLadder)(new BlockDecorLadder( public static final EdLadderBlock METAL_RUNG_STEPS = (EdLadderBlock)(new EdLadderBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 25f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 25f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_rung_steps")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_rung_steps"));
public static final BlockDecorLadder TREATED_WOOD_LADDER = (BlockDecorLadder)(new BlockDecorLadder( public static final EdLadderBlock TREATED_WOOD_LADDER = (EdLadderBlock)(new EdLadderBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.0f, 25f).sound(SoundType.WOOD).notSolid() Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.0f, 25f).sound(SoundType.WOOD).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_ladder")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_ladder"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor.WaterLoggable TREATED_WOOD_TABLE = (BlockDecor.WaterLoggable)(new BlockDecor.WaterLoggable( public static final DecorBlock.WaterLoggable TREATED_WOOD_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(1,0,1, 15,15.9,15) Auxiliaries.getPixeledAABB(1,0,1, 15,15.9,15)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_table")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_table"));
public static final BlockDecorChair TREATED_WOOD_STOOL = (BlockDecorChair)(new BlockDecorChair( public static final EdChair.ChairBlock TREATED_WOOD_STOOL = (EdChair.ChairBlock)(new EdChair.ChairBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(4,7,4, 12,8.8,12), Auxiliaries.getPixeledAABB(4,7,4, 12,8.8,12),
@ -238,154 +243,154 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_stool")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_stool"));
public static final BlockDecor.WaterLoggable TREATED_WOOD_SIDE_TABLE = (BlockDecor.WaterLoggable)(new BlockDecor.WaterLoggable( public static final DecorBlock.WaterLoggable TREATED_WOOD_SIDE_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(2,0,2, 14,15.9,14) Auxiliaries.getPixeledAABB(2,0,2, 14,15.9,14)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_side_table")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_side_table"));
public static final BlockDecor.DirectedWaterLoggable TREATED_WOOD_WINDOWSILL = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable TREATED_WOOD_WINDOWSILL = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(0.5,15,10.5, 15.5,16,16) Auxiliaries.getPixeledAABB(0.5,15,10.5, 15.5,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_windowsill")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_windowsill"));
public static final BlockDecor.DirectedWaterLoggable TREATED_WOOD_BROAD_WINDOWSILL = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable TREATED_WOOD_BROAD_WINDOWSILL = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(0,14.5,4, 16,16,16) Auxiliaries.getPixeledAABB(0,14.5,4, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_broad_windowsill")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_broad_windowsill"));
public static final BlockDecor.DirectedWaterLoggable INSET_LIGHT_IRON = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable INSET_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).lightValue(15).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).lightValue(15).notSolid(),
Auxiliaries.getPixeledAABB(5.2,5.2,0, 10.8,10.8,0.3) Auxiliaries.getPixeledAABB(5.2,5.2,0, 10.8,10.8,0.3)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "iron_inset_light")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "iron_inset_light"));
public static final BlockDecor.DirectedWaterLoggable FLOOR_EDGE_LIGHT_IRON = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable FLOOR_EDGE_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).lightValue(15).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).lightValue(15).notSolid(),
Auxiliaries.getPixeledAABB(5,0,0, 11,2,0.5) Auxiliaries.getPixeledAABB(5,0,0, 11,2,0.5)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "iron_floor_edge_light")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "iron_floor_edge_light"));
public static final BlockDecor.WaterLoggable STEEL_TABLE = (BlockDecor.WaterLoggable)(new BlockDecor.WaterLoggable( public static final DecorBlock.WaterLoggable STEEL_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_table")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_table"));
public static final BlockDecorFloorGrating STEEL_FLOOR_GRATING = (BlockDecorFloorGrating)(new BlockDecorFloorGrating( public static final EdFloorGratingBlock STEEL_FLOOR_GRATING = (EdFloorGratingBlock)(new EdFloorGratingBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(0,14,0, 16,15.5,16) Auxiliaries.getPixeledAABB(0,14,0, 16,15.5,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_floor_grating")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_floor_grating"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorWindow TREATED_WOOD_WINDOW = (BlockDecorWindow)(new BlockDecorWindow( public static final EdWindowBlock TREATED_WOOD_WINDOW = (EdWindowBlock)(new EdWindowBlock(
BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS).notSolid(),
Auxiliaries.getPixeledAABB(0,0,7, 16,16,9) Auxiliaries.getPixeledAABB(0,0,7, 16,16,9)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_window")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_window"));
public static final BlockDecorWindow STEEL_FRAMED_WINDOW = (BlockDecorWindow)(new BlockDecorWindow( public static final EdWindowBlock STEEL_FRAMED_WINDOW = (EdWindowBlock)(new EdWindowBlock(
BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS).notSolid(),
Auxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5) Auxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_framed_window")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_framed_window"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorStraightPole TREATED_WOOD_POLE = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock TREATED_WOOD_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole"));
public static final BlockDecorStraightPole TREATED_WOOD_POLE_HEAD = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock TREATED_WOOD_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole_head")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole_head"));
public static final BlockDecorStraightPole TREATED_WOOD_POLE_SUPPORT = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock TREATED_WOOD_POLE_SUPPORT = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole_support")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_pole_support"));
public static final BlockDecorStraightPole THIN_STEEL_POLE = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock THIN_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(6,6,0, 10,10,16) Auxiliaries.getPixeledAABB(6,6,0, 10,10,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thin_steel_pole")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thin_steel_pole"));
public static final BlockDecorStraightPole THIN_STEEL_POLE_HEAD = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock THIN_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(6,6,0, 10,10,16) Auxiliaries.getPixeledAABB(6,6,0, 10,10,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thin_steel_pole_head")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thin_steel_pole_head"));
public static final BlockDecorStraightPole THICK_STEEL_POLE = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock THICK_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(5,5,0, 11,11,16) Auxiliaries.getPixeledAABB(5,5,0, 11,11,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thick_steel_pole")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thick_steel_pole"));
public static final BlockDecorStraightPole THICK_STEEL_POLE_HEAD = (BlockDecorStraightPole)(new BlockDecorStraightPole( public static final EdStraightPoleBlock THICK_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(5,5,0, 11,11,16) Auxiliaries.getPixeledAABB(5,5,0, 11,11,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thick_steel_pole_head")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "thick_steel_pole_head"));
public static final BlockDecorHorizontalSupport STEEL_DOUBLE_T_SUPPORT = (BlockDecorHorizontalSupport)(new BlockDecorHorizontalSupport( public static final EdHorizontalSupportBlock STEEL_DOUBLE_T_SUPPORT = (EdHorizontalSupportBlock)(new EdHorizontalSupportBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(5,11,0, 11,16,16) Auxiliaries.getPixeledAABB(5,11,0, 11,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_double_t_support")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_double_t_support"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecor.DirectedWaterLoggable SIGN_MODLOGO = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_MODLOGO = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1000f).sound(SoundType.WOOD).lightValue(1).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1000f).sound(SoundType.WOOD).lightValue(1).notSolid(),
Auxiliaries.getPixeledAABB(0,0,15.6, 16,16,16.0) Auxiliaries.getPixeledAABB(0,0,15.6, 16,16,16.0)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_decor")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_decor"));
public static final BlockDecor.DirectedWaterLoggable SIGN_HOTWIRE = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_HOTWIRE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_hotwire")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_hotwire"));
public static final BlockDecor.DirectedWaterLoggable SIGN_DANGER = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_DANGER = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_danger")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_danger"));
public static final BlockDecor.DirectedWaterLoggable SIGN_DEFENSE = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_DEFENSE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_defense")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_defense"));
public static final BlockDecor.DirectedWaterLoggable SIGN_FACTORY_AREA = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_FACTORY_AREA = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_factoryarea")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_factoryarea"));
public static final BlockDecor.DirectedWaterLoggable SIGN_EXIT = (BlockDecor.DirectedWaterLoggable)(new BlockDecor.DirectedWaterLoggable( public static final DecorBlock.DirectedWaterLoggable SIGN_EXIT = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_HORIZIONTAL, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(3,7,15.6, 13,13,16) Auxiliaries.getPixeledAABB(3,7,15.6, 13,13,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_exit")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "sign_exit"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorCraftingTable.CraftingTableBlock TREATED_WOOD_CRAFTING_TABLE = (BlockDecorCraftingTable.CraftingTableBlock)(new BlockDecorCraftingTable.CraftingTableBlock( public static final EdCraftingTable.CraftingTableBlock TREATED_WOOD_CRAFTING_TABLE = (EdCraftingTable.CraftingTableBlock)(new EdCraftingTable.CraftingTableBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 15f).sound(SoundType.WOOD).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0,13,0, 16,16,16), Auxiliaries.getPixeledAABB(0,13,0, 16,16,16),
@ -393,8 +398,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_crafting_table")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_crafting_table"));
public static final BlockDecorFurnace.DecorFurnaceBlock SMALL_LAB_FURNACE = (BlockDecorFurnace.DecorFurnaceBlock)(new BlockDecorFurnace.DecorFurnaceBlock( public static final FurnaceBlock SMALL_LAB_FURNACE = (FurnaceBlock)(new FurnaceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(1,0,1, 15, 1,15), Auxiliaries.getPixeledAABB(1,0,1, 15, 1,15),
@ -402,8 +407,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_lab_furnace")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_lab_furnace"));
public static final BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock SMALL_ELECTRICAL_FURNACE = (BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock)(new BlockDecorFurnaceElectrical.DecorFurnaceElectricalBlock( public static final EdElectricalFurnace.ElectricalFurnaceBlock SMALL_ELECTRICAL_FURNACE = (EdElectricalFurnace.ElectricalFurnaceBlock)(new EdElectricalFurnace.ElectricalFurnaceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0, 0,0, 16,11,16), Auxiliaries.getPixeledAABB(0, 0,0, 16,11,16),
@ -414,14 +419,14 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_electrical_furnace")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_electrical_furnace"));
public static final BlockDecorDropper FACTORY_DROPPER = (BlockDecorDropper)(new BlockDecorDropper( public static final EdDropper.DropperBlock FACTORY_DROPPER = (EdDropper.DropperBlock)(new EdDropper.DropperBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(0,0,1, 16,16,16) Auxiliaries.getPixeledAABB(0,0,1, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_dropper")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_dropper"));
public static final BlockDecorPlacer FACTORY_PLACER = (BlockDecorPlacer)(new BlockDecorPlacer( public static final EdPlacer.PlacerBlock FACTORY_PLACER = (EdPlacer.PlacerBlock)(new EdPlacer.PlacerBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0,0,2, 16,16,16), Auxiliaries.getPixeledAABB(0,0,2, 16,16,16),
@ -430,8 +435,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_placer")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_placer"));
public static final BlockDecorBreaker SMALL_BLOCK_BREAKER = (BlockDecorBreaker)(new BlockDecorBreaker( public static final EdBreaker.BreakerBlock SMALL_BLOCK_BREAKER = (EdBreaker.BreakerBlock)(new EdBreaker.BreakerBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(1,0,0, 15, 4, 7), Auxiliaries.getPixeledAABB(1,0,0, 15, 4, 7),
@ -443,8 +448,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_block_breaker")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_block_breaker"));
public static final BlockDecorHopper.DecorHopperBlock FACTORY_HOPPER = (BlockDecorHopper.DecorHopperBlock)(new BlockDecorHopper.DecorHopperBlock( public static final EdHopper.HopperBlock FACTORY_HOPPER = (EdHopper.HopperBlock)(new EdHopper.HopperBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),()->{ Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),()->{
final AxisAlignedBB[] down_aabbs = new AxisAlignedBB[]{ final AxisAlignedBB[] down_aabbs = new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 5, 0, 5, 11, 1,11), Auxiliaries.getPixeledAABB( 5, 0, 5, 11, 1,11),
@ -489,20 +494,20 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_hopper")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "factory_hopper"));
public static final BlockDecorWasteIncinerator SMALL_WASTE_INCINERATOR = (BlockDecorWasteIncinerator)(new BlockDecorWasteIncinerator( public static final EdWasteIncinerator.WasteIncineratorBlock SMALL_WASTE_INCINERATOR = (EdWasteIncinerator.WasteIncineratorBlock)(new EdWasteIncinerator.WasteIncineratorBlock(
BlockDecor.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_waste_incinerator")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_waste_incinerator"));
public static final BlockDecorMineralSmelter.DecorMineralSmelterBlock SMALL_MINERAL_SMELTER = (BlockDecorMineralSmelter.DecorMineralSmelterBlock)(new BlockDecorMineralSmelter.DecorMineralSmelterBlock( public static final EdMineralSmelter.MineralSmelterBlock SMALL_MINERAL_SMELTER = (EdMineralSmelter.MineralSmelterBlock)(new EdMineralSmelter.MineralSmelterBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(1.1,0,1.1, 14.9,16,14.9) Auxiliaries.getPixeledAABB(1.1,0,1.1, 14.9,16,14.9)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_mineral_smelter")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_mineral_smelter"));
public static final BlockDecorSolarPanel SMALL_SOLAR_PANEL = (BlockDecorSolarPanel)(new BlockDecorSolarPanel( public static final EdSolarPanel.SolarPanelBlock SMALL_SOLAR_PANEL = (EdSolarPanel.SolarPanelBlock)(new EdSolarPanel.SolarPanelBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0,0,0, 16,2,16), Auxiliaries.getPixeledAABB(0,0,0, 16,2,16),
@ -510,8 +515,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_solar_panel")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_solar_panel"));
public static final BlockDecorMilker SMALL_MILKING_MACHINE = (BlockDecorMilker)(new BlockDecorMilker( public static final EdMilker.MilkerBlock SMALL_MILKING_MACHINE = (EdMilker.MilkerBlock)(new EdMilker.MilkerBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 1, 1,0, 15,14,10), Auxiliaries.getPixeledAABB( 1, 1,0, 15,14,10),
@ -522,8 +527,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_milking_machine")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_milking_machine"));
public static final BlockDecorTreeCutter SMALL_TREE_CUTTER = (BlockDecorTreeCutter)(new BlockDecorTreeCutter( public static final EdTreeCutter.TreeCutterBlock SMALL_TREE_CUTTER = (EdTreeCutter.TreeCutterBlock)(new EdTreeCutter.TreeCutterBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 0,0, 0, 16,3,16), Auxiliaries.getPixeledAABB( 0,0, 0, 16,3,16),
@ -535,9 +540,9 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_tree_cutter")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_tree_cutter"));
public static final BlockDecorPipeValve.DecorPipeValveBlock STRAIGHT_CHECK_VALVE = (BlockDecorPipeValve.DecorPipeValveBlock)(new BlockDecorPipeValve.DecorPipeValveBlock( public static final EdPipeValve.PipeValveBlock STRAIGHT_CHECK_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
BlockDecorPipeValve.CFG_CHECK_VALVE, EdPipeValve.CFG_CHECK_VALVE,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2),
@ -547,9 +552,9 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve"));
public static final BlockDecorPipeValve.DecorPipeValveBlock STRAIGHT_REDSTONE_VALVE = (BlockDecorPipeValve.DecorPipeValveBlock)(new BlockDecorPipeValve.DecorPipeValveBlock( public static final EdPipeValve.PipeValveBlock STRAIGHT_REDSTONE_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
BlockDecorPipeValve.CFG_REDSTONE_CONTROLLED_VALVE, EdPipeValve.CFG_REDSTONE_CONTROLLED_VALVE,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2),
@ -559,9 +564,9 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone"));
public static final BlockDecorPipeValve.DecorPipeValveBlock STRAIGHT_REDSTONE_ANALOG_VALVE = (BlockDecorPipeValve.DecorPipeValveBlock)(new BlockDecorPipeValve.DecorPipeValveBlock( public static final EdPipeValve.PipeValveBlock STRAIGHT_REDSTONE_ANALOG_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
BlockDecorPipeValve.CFG_REDSTONE_CONTROLLED_VALVE|BlockDecorPipeValve.CFG_ANALOG_VALVE, EdPipeValve.CFG_REDSTONE_CONTROLLED_VALVE|EdPipeValve.CFG_ANALOG_VALVE,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2),
@ -571,8 +576,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone_analog")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone_analog"));
public static final BlockDecorPassiveFluidAccumulator PASSIVE_FLUID_ACCUMULATOR = (BlockDecorPassiveFluidAccumulator)(new BlockDecorPassiveFluidAccumulator( public static final EdFluidAccumulator.FluidAccumulatorBlock PASSIVE_FLUID_ACCUMULATOR = (EdFluidAccumulator.FluidAccumulatorBlock)(new EdFluidAccumulator.FluidAccumulatorBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(3,3,0, 13,13, 1), Auxiliaries.getPixeledAABB(3,3,0, 13,13, 1),
@ -580,8 +585,8 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "passive_fluid_accumulator")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "passive_fluid_accumulator"));
public static final BlockDecorFluidFunnel SMALL_FLUID_FUNNEL = (BlockDecorFluidFunnel)(new BlockDecorFluidFunnel( public static final EdFluidFunnel.FluidFunnelBlock SMALL_FLUID_FUNNEL = (EdFluidFunnel.FluidFunnelBlock)(new EdFluidFunnel.FluidFunnelBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{ new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(0, 0,0, 16,14,16), Auxiliaries.getPixeledAABB(0, 0,0, 16,14,16),
@ -590,72 +595,72 @@ public class ModContent
} }
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_fluid_funnel")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "small_fluid_funnel"));
public static final BlockDecorLabeledCrate.DecorLabeledCrateBlock LABELED_CRATE = (BlockDecorLabeledCrate.DecorLabeledCrateBlock)(new BlockDecorLabeledCrate.DecorLabeledCrateBlock( public static final EdLabeledCrate.DecorLabeledCrateBlock LABELED_CRATE = (EdLabeledCrate.DecorLabeledCrateBlock)(new EdLabeledCrate.DecorLabeledCrateBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(0.5f, 128f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(0.5f, 128f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "labeled_crate")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "labeled_crate"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorWall CONCRETE_WALL = (BlockDecorWall)(new BlockDecorWall( public static final EdWallBlock CONCRETE_WALL = (EdWallBlock)(new EdWallBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 50f).sound(SoundType.STONE).notSolid() Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 50f).sound(SoundType.STONE).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "concrete_wall")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "concrete_wall"));
public static final BlockDecorHalfSlab HALFSLAB_CONCRETE = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_CONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1f, 10f).sound(SoundType.STONE).notSolid() Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1f, 10f).sound(SoundType.STONE).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_concrete")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_concrete"));
public static final BlockDecorHalfSlab HALFSLAB_TREATEDWOOD = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_TREATEDWOOD = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 4f).sound(SoundType.WOOD).notSolid() Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 4f).sound(SoundType.WOOD).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_treated_wood")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_treated_wood"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALIRON = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALIRON = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_iron")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_iron"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALSTEEL = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALSTEEL = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_steel")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_steel"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALCOPPER = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALCOPPER = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_copper")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_copper"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALGOLD = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALGOLD = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_gold")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_gold"));
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALALUMINIUM = (BlockDecorHalfSlab)(new BlockDecorHalfSlab( public static final EdSlabSliceBlock HALFSLAB_SHEETMETALALUMINIUM = (EdSlabSliceBlock)(new EdSlabSliceBlock(
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid() Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_aluminum")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_sheetmetal_aluminum"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorFence STEEL_MESH_FENCE = (BlockDecorFence)(new BlockDecorFence( public static final EdFenceBlock STEEL_MESH_FENCE = (EdFenceBlock)(new EdFenceBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
1.5, 16, 0.25, 0, 16 1.5, 16, 0.25, 0, 16
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_mesh_fence")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_mesh_fence"));
public static final BlockDecorDoubleGate STEEL_MESH_FENCE_GATE = (BlockDecorDoubleGate)(new BlockDecorDoubleGate( public static final EdDoubleGateBlock STEEL_MESH_FENCE_GATE = (EdDoubleGateBlock)(new EdDoubleGateBlock(
BlockDecor.CFG_CUTOUT, DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(0,0,6.5, 16,16,9.5) Auxiliaries.getPixeledAABB(0,0,6.5, 16,16,9.5)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_mesh_fence_gate")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "steel_mesh_fence_gate"));
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
public static final BlockDecorTest TEST_BLOCK = (BlockDecorTest)(new BlockDecorTest( public static final EdTestBlock.TestBlock TEST_BLOCK = (EdTestBlock.TestBlock)(new EdTestBlock.TestBlock(
BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK, DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(0f, 32000f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(0f, 32000f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "test_block")); )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "test_block"));
@ -756,87 +761,87 @@ public class ModContent
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static final TileEntityType<?> TET_TREATED_WOOD_CRAFTING_TABLE = TileEntityType.Builder public static final TileEntityType<?> TET_TREATED_WOOD_CRAFTING_TABLE = TileEntityType.Builder
.create(BlockDecorCraftingTable.CraftingTableTileEntity::new, TREATED_WOOD_CRAFTING_TABLE) .create(EdCraftingTable.CraftingTableTileEntity::new, TREATED_WOOD_CRAFTING_TABLE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_treated_wood_crafting_table"); .setRegistryName(ModEngineersDecor.MODID, "te_treated_wood_crafting_table");
public static final TileEntityType<?> TET_LABELED_CRATE = TileEntityType.Builder public static final TileEntityType<?> TET_LABELED_CRATE = TileEntityType.Builder
.create(BlockDecorLabeledCrate.LabeledCrateTileEntity::new, LABELED_CRATE) .create(EdLabeledCrate.LabeledCrateTileEntity::new, LABELED_CRATE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_labeled_crate"); .setRegistryName(ModEngineersDecor.MODID, "te_labeled_crate");
public static final TileEntityType<?> TET_SMALL_LAB_FURNACE = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_LAB_FURNACE = TileEntityType.Builder
.create(BlockDecorFurnace.DecorFurnaceTileEntity::new, SMALL_LAB_FURNACE) .create(FurnaceTileEntity::new, SMALL_LAB_FURNACE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_lab_furnace"); .setRegistryName(ModEngineersDecor.MODID, "te_small_lab_furnace");
public static final TileEntityType<?> TET_SMALL_ELECTRICAL_FURNACE = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_ELECTRICAL_FURNACE = TileEntityType.Builder
.create(BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity::new, SMALL_ELECTRICAL_FURNACE) .create(EdElectricalFurnace.ElectricalFurnaceTileEntity::new, SMALL_ELECTRICAL_FURNACE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_electrical_furnace"); .setRegistryName(ModEngineersDecor.MODID, "te_small_electrical_furnace");
public static final TileEntityType<?> TET_FACTORY_DROPPER = TileEntityType.Builder public static final TileEntityType<?> TET_FACTORY_DROPPER = TileEntityType.Builder
.create(BlockDecorDropper.BTileEntity::new, FACTORY_DROPPER) .create(EdDropper.DropperTileEntity::new, FACTORY_DROPPER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_factory_dropper"); .setRegistryName(ModEngineersDecor.MODID, "te_factory_dropper");
public static final TileEntityType<?> TET_FACTORY_PLACER = TileEntityType.Builder public static final TileEntityType<?> TET_FACTORY_PLACER = TileEntityType.Builder
.create(BlockDecorPlacer.BTileEntity::new, FACTORY_PLACER) .create(EdPlacer.PlacerTileEntity::new, FACTORY_PLACER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_factory_placer"); .setRegistryName(ModEngineersDecor.MODID, "te_factory_placer");
public static final TileEntityType<?> TET_SMALL_BLOCK_BREAKER = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_BLOCK_BREAKER = TileEntityType.Builder
.create(BlockDecorBreaker.BTileEntity::new, SMALL_BLOCK_BREAKER) .create(EdBreaker.BreakerTileEntity::new, SMALL_BLOCK_BREAKER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_block_breaker"); .setRegistryName(ModEngineersDecor.MODID, "te_small_block_breaker");
public static final TileEntityType<?> TET_FACTORY_HOPPER = TileEntityType.Builder public static final TileEntityType<?> TET_FACTORY_HOPPER = TileEntityType.Builder
.create(BlockDecorHopper.DecorHopperTileEntity::new, FACTORY_HOPPER) .create(EdHopper.HopperTileEntity::new, FACTORY_HOPPER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_factory_hopper"); .setRegistryName(ModEngineersDecor.MODID, "te_factory_hopper");
public static final TileEntityType<?> TET_WASTE_INCINERATOR = TileEntityType.Builder public static final TileEntityType<?> TET_WASTE_INCINERATOR = TileEntityType.Builder
.create(BlockDecorWasteIncinerator.BTileEntity::new, SMALL_WASTE_INCINERATOR) .create(EdWasteIncinerator.WasteIncineratorTileEntity::new, SMALL_WASTE_INCINERATOR)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_waste_incinerator"); .setRegistryName(ModEngineersDecor.MODID, "te_small_waste_incinerator");
public static final TileEntityType<?> TET_STRAIGHT_PIPE_VALVE = TileEntityType.Builder public static final TileEntityType<?> TET_STRAIGHT_PIPE_VALVE = TileEntityType.Builder
.create(BlockDecorPipeValve.DecorPipeValveTileEntity::new, STRAIGHT_CHECK_VALVE, STRAIGHT_REDSTONE_VALVE, STRAIGHT_REDSTONE_ANALOG_VALVE) .create(EdPipeValve.PipeValveTileEntity::new, STRAIGHT_CHECK_VALVE, STRAIGHT_REDSTONE_VALVE, STRAIGHT_REDSTONE_ANALOG_VALVE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_pipe_valve"); .setRegistryName(ModEngineersDecor.MODID, "te_pipe_valve");
public static final TileEntityType<?> TET_PASSIVE_FLUID_ACCUMULATOR = TileEntityType.Builder public static final TileEntityType<?> TET_PASSIVE_FLUID_ACCUMULATOR = TileEntityType.Builder
.create(BlockDecorPassiveFluidAccumulator.BTileEntity::new, PASSIVE_FLUID_ACCUMULATOR) .create(EdFluidAccumulator.FluidAccumulatorTileEntity::new, PASSIVE_FLUID_ACCUMULATOR)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_passive_fluid_accumulator"); .setRegistryName(ModEngineersDecor.MODID, "te_passive_fluid_accumulator");
public static final TileEntityType<?> TET_SMALL_FLUID_FUNNEL = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_FLUID_FUNNEL = TileEntityType.Builder
.create(BlockDecorFluidFunnel.BTileEntity::new, SMALL_FLUID_FUNNEL) .create(EdFluidFunnel.FluidFunnelTileEntity::new, SMALL_FLUID_FUNNEL)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_fluid_funnel"); .setRegistryName(ModEngineersDecor.MODID, "te_small_fluid_funnel");
public static final TileEntityType<?> TET_MINERAL_SMELTER = TileEntityType.Builder public static final TileEntityType<?> TET_MINERAL_SMELTER = TileEntityType.Builder
.create(BlockDecorMineralSmelter.DecorMineralSmelterTileEntity::new, SMALL_MINERAL_SMELTER) .create(EdMineralSmelter.MineralSmelterTileEntity::new, SMALL_MINERAL_SMELTER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_mineral_smelter"); .setRegistryName(ModEngineersDecor.MODID, "te_small_mineral_smelter");
public static final TileEntityType<?> TET_SMALL_SOLAR_PANEL = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_SOLAR_PANEL = TileEntityType.Builder
.create(BlockDecorSolarPanel.BTileEntity::new, SMALL_SOLAR_PANEL) .create(EdSolarPanel.SolarPanelTileEntity::new, SMALL_SOLAR_PANEL)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_solar_panel"); .setRegistryName(ModEngineersDecor.MODID, "te_small_solar_panel");
public static final TileEntityType<?> TET_SMALL_MILKING_MACHINE = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_MILKING_MACHINE = TileEntityType.Builder
.create(BlockDecorMilker.BTileEntity::new, SMALL_MILKING_MACHINE) .create(EdMilker.MilkerTileEntity::new, SMALL_MILKING_MACHINE)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_milking_machine"); .setRegistryName(ModEngineersDecor.MODID, "te_small_milking_machine");
public static final TileEntityType<?> TET_SMALL_TREE_CUTTER = TileEntityType.Builder public static final TileEntityType<?> TET_SMALL_TREE_CUTTER = TileEntityType.Builder
.create(BlockDecorTreeCutter.BTileEntity::new, SMALL_TREE_CUTTER) .create(EdTreeCutter.TreeCutterTileEntity::new, SMALL_TREE_CUTTER)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_small_tree_cutter"); .setRegistryName(ModEngineersDecor.MODID, "te_small_tree_cutter");
public static final TileEntityType<?> TET_TEST_BLOCK = TileEntityType.Builder public static final TileEntityType<?> TET_TEST_BLOCK = TileEntityType.Builder
.create(BlockDecorPipeValve.DecorPipeValveTileEntity::new, TEST_BLOCK) .create(EdTestBlock.TestTileEntity::new, TEST_BLOCK)
.build(null) .build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_test_block"); .setRegistryName(ModEngineersDecor.MODID, "te_test_block");
@ -865,12 +870,12 @@ public class ModContent
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static final EntityType<BlockDecorChair.EntityChair> ET_CHAIR = (EntityType<BlockDecorChair.EntityChair>)( public static final EntityType<EdChair.EntityChair> ET_CHAIR = (EntityType<EdChair.EntityChair>)(
EntityType.Builder EntityType.Builder
.create(BlockDecorChair.EntityChair::new, EntityClassification.MISC) .create(EdChair.EntityChair::new, EntityClassification.MISC)
.immuneToFire().size(1e-3f, 1e-3f).disableSerialization() .immuneToFire().size(1e-3f, 1e-3f).disableSerialization()
.setShouldReceiveVelocityUpdates(false).setUpdateInterval(4) .setShouldReceiveVelocityUpdates(false).setUpdateInterval(4)
.setCustomClientFactory(BlockDecorChair.EntityChair::customClientFactory) .setCustomClientFactory(EdChair.EntityChair::customClientFactory)
.build(new ResourceLocation(ModEngineersDecor.MODID, "et_chair").toString()) .build(new ResourceLocation(ModEngineersDecor.MODID, "et_chair").toString())
.setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "et_chair")) .setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "et_chair"))
); );
@ -883,31 +888,31 @@ public class ModContent
// Container registration // Container registration
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static final ContainerType<BlockDecorCraftingTable.CraftingTableContainer> CT_TREATED_WOOD_CRAFTING_TABLE; public static final ContainerType<EdCraftingTable.CraftingTableContainer> CT_TREATED_WOOD_CRAFTING_TABLE;
public static final ContainerType<BlockDecorDropper.BContainer> CT_FACTORY_DROPPER; public static final ContainerType<EdDropper.DropperContainer> CT_FACTORY_DROPPER;
public static final ContainerType<BlockDecorPlacer.BContainer> CT_FACTORY_PLACER; public static final ContainerType<EdPlacer.PlacerContainer> CT_FACTORY_PLACER;
public static final ContainerType<BlockDecorHopper.DecorHopperContainer> CT_FACTORY_HOPPER; public static final ContainerType<EdHopper.HopperContainer> CT_FACTORY_HOPPER;
public static final ContainerType<BlockDecorFurnace.DecorFurnaceContainer> CT_SMALL_LAB_FURNACE; public static final ContainerType<FurnaceContainer> CT_SMALL_LAB_FURNACE;
public static final ContainerType<BlockDecorFurnaceElectrical.DecorFurnaceElectricalContainer> CT_SMALL_ELECTRICAL_FURNACE; public static final ContainerType<EdElectricalFurnace.ElectricalFurnaceContainer> CT_SMALL_ELECTRICAL_FURNACE;
public static final ContainerType<BlockDecorWasteIncinerator.BContainer> CT_WASTE_INCINERATOR; public static final ContainerType<EdWasteIncinerator.WasteIncineratorContainer> CT_WASTE_INCINERATOR;
public static final ContainerType<BlockDecorLabeledCrate.LabeledCrateContainer> CT_LABELED_CRATE; public static final ContainerType<EdLabeledCrate.LabeledCrateContainer> CT_LABELED_CRATE;
static { static {
CT_TREATED_WOOD_CRAFTING_TABLE = (new ContainerType<BlockDecorCraftingTable.CraftingTableContainer>(BlockDecorCraftingTable.CraftingTableContainer::new)); CT_TREATED_WOOD_CRAFTING_TABLE = (new ContainerType<EdCraftingTable.CraftingTableContainer>(EdCraftingTable.CraftingTableContainer::new));
CT_TREATED_WOOD_CRAFTING_TABLE.setRegistryName(ModEngineersDecor.MODID,"ct_treated_wood_crafting_table"); CT_TREATED_WOOD_CRAFTING_TABLE.setRegistryName(ModEngineersDecor.MODID,"ct_treated_wood_crafting_table");
CT_FACTORY_DROPPER = (new ContainerType<BlockDecorDropper.BContainer>(BlockDecorDropper.BContainer::new)); CT_FACTORY_DROPPER = (new ContainerType<EdDropper.DropperContainer>(EdDropper.DropperContainer::new));
CT_FACTORY_DROPPER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_dropper"); CT_FACTORY_DROPPER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_dropper");
CT_FACTORY_PLACER = (new ContainerType<BlockDecorPlacer.BContainer>(BlockDecorPlacer.BContainer::new)); CT_FACTORY_PLACER = (new ContainerType<EdPlacer.PlacerContainer>(EdPlacer.PlacerContainer::new));
CT_FACTORY_PLACER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_placer"); CT_FACTORY_PLACER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_placer");
CT_FACTORY_HOPPER = (new ContainerType<BlockDecorHopper.DecorHopperContainer>(BlockDecorHopper.DecorHopperContainer::new)); CT_FACTORY_HOPPER = (new ContainerType<EdHopper.HopperContainer>(EdHopper.HopperContainer::new));
CT_FACTORY_HOPPER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_hopper"); CT_FACTORY_HOPPER.setRegistryName(ModEngineersDecor.MODID,"ct_factory_hopper");
CT_SMALL_LAB_FURNACE = (new ContainerType<BlockDecorFurnace.DecorFurnaceContainer>(BlockDecorFurnace.DecorFurnaceContainer::new)); CT_SMALL_LAB_FURNACE = (new ContainerType<FurnaceContainer>(FurnaceContainer::new));
CT_SMALL_LAB_FURNACE.setRegistryName(ModEngineersDecor.MODID,"ct_small_lab_furnace"); CT_SMALL_LAB_FURNACE.setRegistryName(ModEngineersDecor.MODID,"ct_small_lab_furnace");
CT_SMALL_ELECTRICAL_FURNACE = (new ContainerType<BlockDecorFurnaceElectrical.DecorFurnaceElectricalContainer>(BlockDecorFurnaceElectrical.DecorFurnaceElectricalContainer::new)); CT_SMALL_ELECTRICAL_FURNACE = (new ContainerType<EdElectricalFurnace.ElectricalFurnaceContainer>(EdElectricalFurnace.ElectricalFurnaceContainer::new));
CT_SMALL_ELECTRICAL_FURNACE.setRegistryName(ModEngineersDecor.MODID,"ct_small_electrical_furnace"); CT_SMALL_ELECTRICAL_FURNACE.setRegistryName(ModEngineersDecor.MODID,"ct_small_electrical_furnace");
CT_WASTE_INCINERATOR = (new ContainerType<BlockDecorWasteIncinerator.BContainer>(BlockDecorWasteIncinerator.BContainer::new)); CT_WASTE_INCINERATOR = (new ContainerType<EdWasteIncinerator.WasteIncineratorContainer>(EdWasteIncinerator.WasteIncineratorContainer::new));
CT_WASTE_INCINERATOR.setRegistryName(ModEngineersDecor.MODID,"ct_small_waste_incinerator"); CT_WASTE_INCINERATOR.setRegistryName(ModEngineersDecor.MODID,"ct_small_waste_incinerator");
CT_LABELED_CRATE = (new ContainerType<BlockDecorLabeledCrate.LabeledCrateContainer>(BlockDecorLabeledCrate.LabeledCrateContainer::new)); CT_LABELED_CRATE = (new ContainerType<EdLabeledCrate.LabeledCrateContainer>(EdLabeledCrate.LabeledCrateContainer::new));
CT_LABELED_CRATE.setRegistryName(ModEngineersDecor.MODID,"ct_labeled_crate"); CT_LABELED_CRATE.setRegistryName(ModEngineersDecor.MODID,"ct_labeled_crate");
} }
@ -958,7 +963,11 @@ public class ModContent
for(Block e:registeredBlocks) { for(Block e:registeredBlocks) {
ResourceLocation rl = e.getRegistryName(); ResourceLocation rl = e.getRegistryName();
if(rl == null) continue; if(rl == null) continue;
event.getRegistry().register(new BlockItem(e, (new BlockItem.Properties().group(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl)); if(e instanceof StandardBlocks.IBlockItemFactory) {
event.getRegistry().register(((StandardBlocks.IBlockItemFactory)e).getBlockItem(e, (new BlockItem.Properties().group(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl));
} else {
event.getRegistry().register(new BlockItem(e, (new BlockItem.Properties().group(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl));
}
++n; ++n;
} }
} }
@ -997,14 +1006,14 @@ public class ModContent
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static final void registerContainerGuis(final FMLClientSetupEvent event) public static final void registerContainerGuis(final FMLClientSetupEvent event)
{ {
ScreenManager.registerFactory(CT_TREATED_WOOD_CRAFTING_TABLE, BlockDecorCraftingTable.CraftingTableGui::new); ScreenManager.registerFactory(CT_TREATED_WOOD_CRAFTING_TABLE, EdCraftingTable.CraftingTableGui::new);
ScreenManager.registerFactory(CT_LABELED_CRATE, BlockDecorLabeledCrate.LabeledCrateGui::new); ScreenManager.registerFactory(CT_LABELED_CRATE, EdLabeledCrate.LabeledCrateGui::new);
ScreenManager.registerFactory(CT_FACTORY_DROPPER, BlockDecorDropper.BGui::new); ScreenManager.registerFactory(CT_FACTORY_DROPPER, EdDropper.DropperGui::new);
ScreenManager.registerFactory(CT_FACTORY_PLACER, BlockDecorPlacer.BGui::new); ScreenManager.registerFactory(CT_FACTORY_PLACER, EdPlacer.PlacerGui::new);
ScreenManager.registerFactory(CT_FACTORY_HOPPER, BlockDecorHopper.DecorHopperGui::new); ScreenManager.registerFactory(CT_FACTORY_HOPPER, EdHopper.HopperGui::new);
ScreenManager.registerFactory(CT_SMALL_LAB_FURNACE, BlockDecorFurnace.DecorFurnaceGui::new); ScreenManager.registerFactory(CT_SMALL_LAB_FURNACE, FurnaceGui::new);
ScreenManager.registerFactory(CT_SMALL_ELECTRICAL_FURNACE, BlockDecorFurnaceElectrical.DecorFurnaceElectrical::new); ScreenManager.registerFactory(CT_SMALL_ELECTRICAL_FURNACE, EdElectricalFurnace.ElectricalFurnaceGui::new);
ScreenManager.registerFactory(CT_WASTE_INCINERATOR, BlockDecorWasteIncinerator.BGui::new); ScreenManager.registerFactory(CT_WASTE_INCINERATOR, EdWasteIncinerator.WasteIncineratorGui::new);
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -1012,11 +1021,11 @@ public class ModContent
public static final void registerTileEntityRenderers(final FMLClientSetupEvent event) public static final void registerTileEntityRenderers(final FMLClientSetupEvent event)
{ {
ClientRegistry.bindTileEntityRenderer( ClientRegistry.bindTileEntityRenderer(
(TileEntityType<BlockDecorCraftingTable.CraftingTableTileEntity>)TET_TREATED_WOOD_CRAFTING_TABLE, (TileEntityType<EdCraftingTable.CraftingTableTileEntity>)TET_TREATED_WOOD_CRAFTING_TABLE,
wile.engineersdecor.detail.ModRenderers.CraftingTableTer::new wile.engineersdecor.detail.ModRenderers.CraftingTableTer::new
); );
ClientRegistry.bindTileEntityRenderer( ClientRegistry.bindTileEntityRenderer(
(TileEntityType<BlockDecorLabeledCrate.LabeledCrateTileEntity>)TET_LABELED_CRATE, (TileEntityType<EdLabeledCrate.LabeledCrateTileEntity>)TET_LABELED_CRATE,
wile.engineersdecor.detail.ModRenderers.DecorLabeledCrateTer::new wile.engineersdecor.detail.ModRenderers.DecorLabeledCrateTer::new
); );
} }
@ -1044,7 +1053,7 @@ public class ModContent
} }
// Entity renderers // Entity renderers
RenderingRegistry.registerEntityRenderingHandler(ET_CHAIR, RenderingRegistry.registerEntityRenderingHandler(ET_CHAIR,
manager->(new wile.engineersdecor.detail.ModRenderers.InvisibleEntityRenderer<BlockDecorChair.EntityChair>(manager)) manager->(new wile.engineersdecor.detail.ModRenderers.InvisibleEntityRenderer<EdChair.EntityChair>(manager))
); );
} }

View file

@ -1,7 +1,6 @@
package wile.engineersdecor; package wile.engineersdecor;
import wile.engineersdecor.blocks.*; import wile.engineersdecor.blocks.*;
import wile.engineersdecor.detail.ModConfig;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import wile.engineersdecor.libmc.detail.OptionalRecipeCondition; import wile.engineersdecor.libmc.detail.OptionalRecipeCondition;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
@ -86,8 +85,8 @@ public class ModEngineersDecor
private void onSendImc(final InterModEnqueueEvent event) private void onSendImc(final InterModEnqueueEvent event)
{ {
InterModComms.sendTo("inventorysorter", "containerblacklist", ()->ModContent.CT_TREATED_WOOD_CRAFTING_TABLE.getRegistryName()); InterModComms.sendTo("inventorysorter", "containerblacklist", ()->ModContent.CT_TREATED_WOOD_CRAFTING_TABLE.getRegistryName());
InterModComms.sendTo("inventorysorter", "slotblacklist", ()->BlockDecorCraftingTable.CraftingOutputSlot.class.getName()); InterModComms.sendTo("inventorysorter", "slotblacklist", ()-> EdCraftingTable.CraftingOutputSlot.class.getName());
InterModComms.sendTo("inventorysorter", "slotblacklist", ()->BlockDecorCraftingTable.CraftingGridSlot.class.getName()); InterModComms.sendTo("inventorysorter", "slotblacklist", ()-> EdCraftingTable.CraftingGridSlot.class.getName());
} }
private void onRecvImc(final InterModProcessEvent event) private void onRecvImc(final InterModProcessEvent event)
@ -160,7 +159,7 @@ public class ModEngineersDecor
if(!(event.getEntity() instanceof PlayerEntity)) return; if(!(event.getEntity() instanceof PlayerEntity)) return;
final PlayerEntity player = (PlayerEntity)event.getEntity(); final PlayerEntity player = (PlayerEntity)event.getEntity();
if(player.world == null) return; if(player.world == null) return;
if(player.isOnLadder()) BlockDecorLadder.onPlayerUpdateEvent(player); if(player.isOnLadder()) EdLadderBlock.onPlayerUpdateEvent(player);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFull.java * @file DecorBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.function.Supplier; import java.util.function.Supplier;
public class BlockDecor extends StandardBlocks.BaseBlock implements IDecorBlock public class DecorBlock
{ {
public static final long CFG_DEFAULT = StandardBlocks.CFG_DEFAULT; public static final long CFG_DEFAULT = StandardBlocks.CFG_DEFAULT;
public static final long CFG_CUTOUT = StandardBlocks.CFG_CUTOUT; public static final long CFG_CUTOUT = StandardBlocks.CFG_CUTOUT;
@ -39,17 +39,20 @@ public class BlockDecor extends StandardBlocks.BaseBlock implements IDecorBlock
public static final long CFG_STRICT_CONNECTIONS = StandardBlocks.CFG_STRICT_CONNECTIONS; public static final long CFG_STRICT_CONNECTIONS = StandardBlocks.CFG_STRICT_CONNECTIONS;
public static final long CFG_HARD_IE_DEPENDENT = 0x8000000000000000L; public static final long CFG_HARD_IE_DEPENDENT = 0x8000000000000000L;
public BlockDecor(long conf, Block.Properties properties) public static class Normal extends StandardBlocks.BaseBlock implements IDecorBlock
{ super(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); } {
public Normal(long conf, Block.Properties properties)
{ super(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); }
public BlockDecor(long conf, Block.Properties properties, AxisAlignedBB aabb) public Normal(long conf, Block.Properties properties, AxisAlignedBB aabb)
{ super(conf, properties, aabb);} { super(conf, properties, aabb);}
public BlockDecor(long conf, Block.Properties properties, VoxelShape voxel_shape) public Normal(long conf, Block.Properties properties, VoxelShape voxel_shape)
{ super(conf, properties, voxel_shape); } { super(conf, properties, voxel_shape); }
public BlockDecor(long conf, Block.Properties properties, AxisAlignedBB[] aabbs) public Normal(long conf, Block.Properties properties, AxisAlignedBB[] aabbs)
{ super(conf, properties, aabbs); } { super(conf, properties, aabbs); }
}
public static class WaterLoggable extends StandardBlocks.WaterLoggable implements IStandardBlock, IWaterLoggable public static class WaterLoggable extends StandardBlocks.WaterLoggable implements IStandardBlock, IWaterLoggable
{ {

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorBreaker.java * @file EdBreaker.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -45,86 +45,93 @@ import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockDecorBreaker extends BlockDecor.HorizontalWaterLoggable implements IDecorBlock public class EdBreaker
{ {
public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorBreaker(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) public static class BreakerBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock
{ super(config, builder, unrotatedAABBs); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(ACTIVE); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(ACTIVE, false); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{ {
if((state.getBlock()!=this) || (!state.get(ACTIVE))) return; public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
final double rv = rnd.nextDouble();
if(rv > 0.8) return; public BreakerBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ(); { super(config, builder, unrotatedAABBs); }
final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2);
switch(state.get(HORIZONTAL_FACING)) { @Override
case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break; protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break; { super.fillStateContainer(builder); builder.add(ACTIVE); }
case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break;
default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break; @Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(ACTIVE, false); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BreakerTileEntity(); }
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{
if((state.getBlock()!=this) || (!state.get(ACTIVE))) return;
final double rv = rnd.nextDouble();
if(rv > 0.8) return;
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ();
final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2);
switch(state.get(HORIZONTAL_FACING)) {
case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break;
case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break;
case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break;
default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break;
}
} }
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{ {
if(!(world instanceof World) || (((World) world).isRemote)) return; if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return; if(!(te instanceof BreakerTileEntity)) return;
((BTileEntity)te).block_updated(); ((BreakerTileEntity)te).block_updated();
} }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state) public boolean canProvidePower(BlockState state)
{ return true; } { return true; }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; } { return 0; }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; } { return 0; }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(te instanceof BTileEntity) ((BTileEntity)te).state_message(player); if(te instanceof BreakerTileEntity) ((BreakerTileEntity)te).state_message(player);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage public static class BreakerTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage
{ {
public static final int IDLE_TICK_INTERVAL = 40; public static final int IDLE_TICK_INTERVAL = 40;
public static final int TICK_INTERVAL = 5; public static final int TICK_INTERVAL = 5;
@ -154,10 +161,10 @@ public class BlockDecorBreaker extends BlockDecor.HorizontalWaterLoggable implem
ModEngineersDecor.logger().info("Config block breaker: Boost energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t, reluctance=" + breaking_reluctance + "t/hrdn, break time offset=" + min_breaking_time + "t"); ModEngineersDecor.logger().info("Config block breaker: Boost energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t, reluctance=" + breaking_reluctance + "t/hrdn, break time offset=" + min_breaking_time + "t");
} }
public BTileEntity() public BreakerTileEntity()
{ super(ModContent.TET_SMALL_BLOCK_BREAKER); } { super(ModContent.TET_SMALL_BLOCK_BREAKER); }
public BTileEntity(TileEntityType<?> te_type) public BreakerTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void block_updated() public void block_updated()
@ -273,7 +280,7 @@ public class BlockDecorBreaker extends BlockDecor.HorizontalWaterLoggable implem
drops = ((IDecorBlock)block).dropList(state, world, pos, false); drops = ((IDecorBlock)block).dropList(state, world, pos, false);
} }
world.removeBlock(pos, false); world.removeBlock(pos, false);
for(ItemStack drop:drops) spawnAsEntity(world, pos, drop); for(ItemStack drop:drops) Block.spawnAsEntity(world, pos, drop);
SoundType stype = state.getBlock().getSoundType(state, world, pos, null); SoundType stype = state.getBlock().getSoundType(state, world, pos, null);
if(stype != null) world.playSound(null, pos, stype.getPlaceSound(), SoundCategory.BLOCKS, stype.getVolume()*0.6f, stype.getPitch()); if(stype != null) world.playSound(null, pos, stype.getPlaceSound(), SoundCategory.BLOCKS, stype.getVolume()*0.6f, stype.getPitch());
return true; return true;
@ -286,13 +293,13 @@ public class BlockDecorBreaker extends BlockDecor.HorizontalWaterLoggable implem
if(--tick_timer_ > 0) return; if(--tick_timer_ > 0) return;
if(world.isRemote) { if(world.isRemote) {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if(!state.get(ACTIVE)) { if(!state.get(BreakerBlock.ACTIVE)) {
tick_timer_ = TICK_INTERVAL; tick_timer_ = TICK_INTERVAL;
} else { } else {
tick_timer_ = 1; tick_timer_ = 1;
// not sure if is so cool to do this each tick ... may be simplified/removed again. // not sure if is so cool to do this each tick ... may be simplified/removed again.
SoundEvent sound = SoundEvents.BLOCK_WOOD_HIT; SoundEvent sound = SoundEvents.BLOCK_WOOD_HIT;
BlockState target_state = world.getBlockState(pos.offset(state.get(HORIZONTAL_FACING))); BlockState target_state = world.getBlockState(pos.offset(state.get(BreakerBlock.HORIZONTAL_FACING)));
SoundType stype = target_state.getBlock().getSoundType(target_state); SoundType stype = target_state.getBlock().getSoundType(target_state);
if((stype == SoundType.CLOTH) || (stype == SoundType.PLANT) || (stype == SoundType.SNOW)) { if((stype == SoundType.CLOTH) || (stype == SoundType.PLANT) || (stype == SoundType.SNOW)) {
sound = SoundEvents.BLOCK_WOOL_HIT; sound = SoundEvents.BLOCK_WOOL_HIT;
@ -304,10 +311,10 @@ public class BlockDecorBreaker extends BlockDecor.HorizontalWaterLoggable implem
} else { } else {
tick_timer_ = TICK_INTERVAL; tick_timer_ = TICK_INTERVAL;
final BlockState device_state = world.getBlockState(pos); final BlockState device_state = world.getBlockState(pos);
final BlockPos target_pos = pos.offset(device_state.get(HORIZONTAL_FACING)); final BlockPos target_pos = pos.offset(device_state.get(BreakerBlock.HORIZONTAL_FACING));
final BlockState target_state = world.getBlockState(target_pos); final BlockState target_state = world.getBlockState(target_pos);
if((world.isBlockPowered(pos)) || (!isBreakable(target_state, target_pos, world))) { if((world.isBlockPowered(pos)) || (!isBreakable(target_state, target_pos, world))) {
if(device_state.get(ACTIVE)) world.setBlockState(pos, device_state.with(ACTIVE, false), 1|2); if(device_state.get(BreakerBlock.ACTIVE)) world.setBlockState(pos, device_state.with(BreakerBlock.ACTIVE, false), 1|2);
proc_time_elapsed_ = 0; proc_time_elapsed_ = 0;
tick_timer_ = IDLE_TICK_INTERVAL; tick_timer_ = IDLE_TICK_INTERVAL;
return; return;
@ -333,8 +340,8 @@ public class BlockDecorBreaker extends BlockDecor.HorizontalWaterLoggable implem
breakBlock(target_state, target_pos, world); breakBlock(target_state, target_pos, world);
active = false; active = false;
} }
if(device_state.get(ACTIVE) != active) { if(device_state.get(BreakerBlock.ACTIVE) != active) {
world.setBlockState(pos, device_state.with(ACTIVE, active), 1|2); world.setBlockState(pos, device_state.with(BreakerBlock.ACTIVE, active), 1|2);
} }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFull.java * @file EdChair.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -28,7 +28,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockDecorChair extends BlockDecor.HorizontalWaterLoggable implements IDecorBlock public class EdChair
{ {
private static boolean sitting_enabled = true; private static boolean sitting_enabled = true;
private static double sitting_probability = 0.1; private static double sitting_probability = 0.1;
@ -42,41 +42,48 @@ public class BlockDecorChair extends BlockDecor.HorizontalWaterLoggable implemen
ModEngineersDecor.logger().info("Config chairs: " + sitting_enabled + ", sit: " + sitting_probability, ", stand up: " + standup_probability); ModEngineersDecor.logger().info("Config chairs: " + sitting_enabled + ", sit: " + sitting_probability, ", stand up: " + standup_probability);
} }
public BlockDecorChair(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) //--------------------------------------------------------------------------------------------------------------------
{ super(config, builder.tickRandomly(), unrotatedAABBs); } // Block
//--------------------------------------------------------------------------------------------------------------------
@Override public static class ChairBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(!sitting_enabled) return ActionResultType.PASS; public ChairBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
if(!world.isRemote) EntityChair.sit(world, player, pos); { super(config, builder.tickRandomly(), unrotatedAABBs); }
return ActionResultType.SUCCESS;
}
@Override @Override
@SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
{ if(!sitting_enabled) return ActionResultType.PASS;
if(sitting_enabled && (Math.random() < sitting_probability) && (entity instanceof MobEntity)) EntityChair.sit(world, (LivingEntity)entity, pos); if(!world.isRemote) EntityChair.sit(world, player, pos);
} return ActionResultType.SUCCESS;
}
@Override @Override
public int tickRate(IWorldReader world) @SuppressWarnings("deprecation")
{ return 10; } public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity)
{
if(sitting_enabled && (Math.random() < sitting_probability) && (entity instanceof MobEntity)) EntityChair.sit(world, (LivingEntity)entity, pos);
}
@Override @Override
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rnd) public int tickRate(IWorldReader world)
{ { return 10; }
if((!sitting_enabled) || (sitting_probability < 1e-6)) return;
final List<LivingEntity> entities = world.getEntitiesWithinAABB(MobEntity.class, new AxisAlignedBB(pos).grow(2,1,2).expand(0,1,0), e->true); @Override
if(entities.isEmpty()) return; public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rnd)
int index = rnd.nextInt(entities.size()); {
if((index < 0) || (index >= entities.size())) return; if((!sitting_enabled) || (sitting_probability < 1e-6)) return;
EntityChair.sit(world, entities.get(index), pos); final List<LivingEntity> entities = world.getEntitiesWithinAABB(MobEntity.class, new AxisAlignedBB(pos).grow(2,1,2).expand(0,1,0), e->true);
if(entities.isEmpty()) return;
int index = rnd.nextInt(entities.size());
if((index < 0) || (index >= entities.size())) return;
EntityChair.sit(world, entities.get(index), pos);
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Riding entity for sitting // Entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class EntityChair extends Entity public static class EntityChair extends Entity
@ -171,7 +178,7 @@ public class BlockDecorChair extends BlockDecor.HorizontalWaterLoggable implemen
} }
boolean abort = (!sitting_enabled); boolean abort = (!sitting_enabled);
final BlockState state = world.getBlockState(chair_pos); final BlockState state = world.getBlockState(chair_pos);
if((state==null) || (!(state.getBlock() instanceof BlockDecorChair))) abort = true; if((state==null) || (!(state.getBlock() instanceof ChairBlock))) abort = true;
if(!world.isAirBlock(chair_pos.up())) abort = true; if(!world.isAirBlock(chair_pos.up())) abort = true;
if((!(sitter instanceof PlayerEntity)) && (Math.random() < standup_probability)) abort = true; if((!(sitter instanceof PlayerEntity)) && (Math.random() < standup_probability)) abort = true;
if(abort) { if(abort) {

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecor.Directed.java * @file EdCraftingTable.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -56,7 +56,7 @@ import java.util.stream.Collectors;
import java.util.Arrays; import java.util.Arrays;
public class BlockDecorCraftingTable public class EdCraftingTable
{ {
public static boolean with_assist = true; public static boolean with_assist = true;
public static boolean with_assist_direct_history_refab = false; public static boolean with_assist_direct_history_refab = false;
@ -79,7 +79,7 @@ public class BlockDecorCraftingTable
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static final class CraftingTableBlock extends BlockDecor.HorizontalWaterLoggable implements IDecorBlock public static final class CraftingTableBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock
{ {
public CraftingTableBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) public CraftingTableBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
{ super(config, builder, unrotatedAABBs); } { super(config, builder, unrotatedAABBs); }
@ -91,7 +91,7 @@ public class BlockDecorCraftingTable
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorCraftingTable.CraftingTableTileEntity(); } { return new EdCraftingTable.CraftingTableTileEntity(); }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
@ -306,6 +306,20 @@ public class BlockDecorCraftingTable
public static class CraftingTableContainer extends Container implements Networking.INetworkSynchronisableContainer public static class CraftingTableContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
protected static final String BUTTON_NEXT = "next";
protected static final String BUTTON_PREV = "prev";
protected static final String BUTTON_CLEAR_GRID = "clear";
protected static final String BUTTON_FROM_STORAGE = "from-storage";
protected static final String BUTTON_TO_STORAGE = "to-storage";
protected static final String BUTTON_FROM_PLAYER = "from-player";
protected static final String BUTTON_TO_PLAYER = "to-player";
protected static final String BUTTON_NEXT_COLLISION_RECIPE = "next-recipe";
protected static final String ACTION_PLACE_CURRENT_HISTORY_SEL = "place-refab";
protected static final String ACTION_PLACE_SHIFTCLICKED_STACK = "place-stack";
protected static final String ACTION_MOVE_ALL_STACKS = "move-stacks";
protected static final String ACTION_INCREASE_CRAFTING_STACKS = "inc-crafting-stacks";
protected static final String ACTION_DECREASE_CRAFTING_STACKS = "dec-crafting-stacks";
public static final int CRAFTING_SLOTS_BEGIN = 0; public static final int CRAFTING_SLOTS_BEGIN = 0;
public static final int NUM_OF_CRAFTING_SLOTS = 9; public static final int NUM_OF_CRAFTING_SLOTS = 9;
public static final int STORAGE_SLOTS_BEGIN = NUM_OF_CRAFTING_SLOTS; public static final int STORAGE_SLOTS_BEGIN = NUM_OF_CRAFTING_SLOTS;
@ -502,39 +516,39 @@ public class BlockDecorCraftingTable
boolean player_inventory_changed = false; boolean player_inventory_changed = false;
if(with_assist && nbt.contains("action")) { if(with_assist && nbt.contains("action")) {
switch(nbt.getString("action")) { switch(nbt.getString("action")) {
case CraftingTableGui.BUTTON_NEXT: { case BUTTON_NEXT: {
history_.next(); history_.next();
syncHistory(); syncHistory();
// implicitly clear the grid, so that the player can see the refab, and that no recipe is active. // implicitly clear the grid, so that the player can see the refab, and that no recipe is active.
if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) changed = true; if(clear_grid_to_storage(player)) changed = true;
} break; } break;
case CraftingTableGui.BUTTON_PREV: { case BUTTON_PREV: {
history_.prev(); history_.prev();
syncHistory(); syncHistory();
if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) changed = true; if(clear_grid_to_storage(player)) changed = true;
} break; } break;
case CraftingTableGui.BUTTON_CLEAR_GRID: { case BUTTON_CLEAR_GRID: {
history_.reset_selection(); history_.reset_selection();
syncHistory(); syncHistory();
if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; }
if(clear_grid_to_storage(player)) changed = true; if(clear_grid_to_storage(player)) changed = true;
} break; } break;
case CraftingTableGui.BUTTON_TO_STORAGE: { case BUTTON_TO_STORAGE: {
if(clear_grid_to_storage(player)) changed = true; if(clear_grid_to_storage(player)) changed = true;
} break; } break;
case CraftingTableGui.BUTTON_TO_PLAYER: { case BUTTON_TO_PLAYER: {
if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; } if(clear_grid_to_player(player)) { changed = true; player_inventory_changed = true; }
} break; } break;
case CraftingTableGui.BUTTON_FROM_STORAGE: { case BUTTON_FROM_STORAGE: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(inventory_, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS) new SlotRange(inventory_, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS)
}, refab_crafting_stacks()) != PlacementResult.UNCHANGED) { }, refab_crafting_stacks()) != PlacementResult.UNCHANGED) {
changed = true; changed = true;
} }
} break; } break;
case CraftingTableGui.BUTTON_FROM_PLAYER: { case BUTTON_FROM_PLAYER: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9) new SlotRange(player.inventory, 0, 9)
@ -542,7 +556,7 @@ public class BlockDecorCraftingTable
changed = true; player_inventory_changed = true; changed = true; player_inventory_changed = true;
} }
} break; } break;
case CraftingTableGui.ACTION_PLACE_CURRENT_HISTORY_SEL: { case ACTION_PLACE_CURRENT_HISTORY_SEL: {
if(place_stacks(new SlotRange[]{ if(place_stacks(new SlotRange[]{
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
@ -551,7 +565,7 @@ public class BlockDecorCraftingTable
changed = true; changed = true;
} }
} break; } break;
case CraftingTableGui.ACTION_PLACE_SHIFTCLICKED_STACK: { case ACTION_PLACE_SHIFTCLICKED_STACK: {
final int container_slot_id = nbt.getInt("containerslot"); final int container_slot_id = nbt.getInt("containerslot");
if((container_slot_id < 10) || (container_slot_id > 53)) { if((container_slot_id < 10) || (container_slot_id > 53)) {
break; // out of range break; // out of range
@ -578,7 +592,7 @@ public class BlockDecorCraftingTable
} }
} }
} break; } break;
case CraftingTableGui.ACTION_MOVE_ALL_STACKS: { case ACTION_MOVE_ALL_STACKS: {
final int container_slot_id = nbt.getInt("containerslot"); final int container_slot_id = nbt.getInt("containerslot");
if((container_slot_id < 1) || (container_slot_id > 53)) { if((container_slot_id < 1) || (container_slot_id > 53)) {
break; // out of range break; // out of range
@ -623,17 +637,17 @@ public class BlockDecorCraftingTable
} }
} }
} break; } break;
case CraftingTableGui.BUTTON_NEXT_COLLISION_RECIPE: { case BUTTON_NEXT_COLLISION_RECIPE: {
select_next_collision_recipe(inventory_); select_next_collision_recipe(inventory_);
} break; } break;
case CraftingTableGui.ACTION_DECREASE_CRAFTING_STACKS: { case ACTION_DECREASE_CRAFTING_STACKS: {
changed = player_inventory_changed = decrease_grid_stacks(new SlotRange[]{ changed = player_inventory_changed = decrease_grid_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),
new SlotRange(inventory_, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS) new SlotRange(inventory_, STORAGE_SLOTS_BEGIN, STORAGE_SLOTS_BEGIN+NUM_OF_STORAGE_SLOTS)
}, MathHelper.clamp(nbt.getInt("limit"), 1, 8)); }, MathHelper.clamp(nbt.getInt("limit"), 1, 8));
} break; } break;
case CraftingTableGui.ACTION_INCREASE_CRAFTING_STACKS: { case ACTION_INCREASE_CRAFTING_STACKS: {
changed = player_inventory_changed = increase_grid_stacks(new SlotRange[]{ changed = player_inventory_changed = increase_grid_stacks(new SlotRange[]{
new SlotRange(player.inventory, 9, 36), new SlotRange(player.inventory, 9, 36),
new SlotRange(player.inventory, 0, 9), new SlotRange(player.inventory, 0, 9),
@ -1076,19 +1090,6 @@ public class BlockDecorCraftingTable
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class CraftingTableGui extends ContainerScreen<CraftingTableContainer> public static class CraftingTableGui extends ContainerScreen<CraftingTableContainer>
{ {
protected static final String BUTTON_NEXT = "next";
protected static final String BUTTON_PREV = "prev";
protected static final String BUTTON_CLEAR_GRID = "clear";
protected static final String BUTTON_FROM_STORAGE = "from-storage";
protected static final String BUTTON_TO_STORAGE = "to-storage";
protected static final String BUTTON_FROM_PLAYER = "from-player";
protected static final String BUTTON_TO_PLAYER = "to-player";
protected static final String BUTTON_NEXT_COLLISION_RECIPE = "next-recipe";
protected static final String ACTION_PLACE_CURRENT_HISTORY_SEL = "place-refab";
protected static final String ACTION_PLACE_SHIFTCLICKED_STACK = "place-stack";
protected static final String ACTION_MOVE_ALL_STACKS = "move-stacks";
protected static final String ACTION_INCREASE_CRAFTING_STACKS = "inc-crafting-stacks";
protected static final String ACTION_DECREASE_CRAFTING_STACKS = "dec-crafting-stacks";
protected static final ResourceLocation BACKGROUND = new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/treated_wood_crafting_table.png"); protected static final ResourceLocation BACKGROUND = new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/treated_wood_crafting_table.png");
protected final PlayerEntity player; protected final PlayerEntity player;
protected final ArrayList<Button> buttons = new ArrayList<Button>(); protected final ArrayList<Button> buttons = new ArrayList<Button>();
@ -1107,15 +1108,15 @@ public class BlockDecorCraftingTable
final int x0=guiLeft, y0=guiTop; final int x0=guiLeft, y0=guiTop;
buttons.clear(); buttons.clear();
if(with_assist) { if(with_assist) {
buttons.add(addButton(new ImageButton(x0+158,y0+44, 12,12, 194,44, 12, BACKGROUND, (bt)->action(BUTTON_NEXT)))); buttons.add(addButton(new ImageButton(x0+158,y0+44, 12,12, 194,44, 12, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_NEXT))));
buttons.add(addButton(new ImageButton(x0+158,y0+30, 12,12, 180,30, 12, BACKGROUND, (bt)->action(BUTTON_PREV)))); buttons.add(addButton(new ImageButton(x0+158,y0+30, 12,12, 180,30, 12, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_PREV))));
buttons.add(addButton(new ImageButton(x0+158,y0+58, 12,12, 194,8, 12, BACKGROUND, (bt)->action(BUTTON_CLEAR_GRID)))); buttons.add(addButton(new ImageButton(x0+158,y0+58, 12,12, 194,8, 12, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_CLEAR_GRID))));
buttons.add(addButton(new ImageButton(x0+132,y0+18, 20,10, 183,95, 12, BACKGROUND, (bt)->action(BUTTON_NEXT_COLLISION_RECIPE)))); buttons.add(addButton(new ImageButton(x0+132,y0+18, 20,10, 183,95, 12, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_NEXT_COLLISION_RECIPE))));
if(with_assist_quickmove_buttons) { if(with_assist_quickmove_buttons) {
buttons.add(addButton(new ImageButton(x0+49, y0+34, 9,17, 219,34, 17, BACKGROUND, (bt)->action(BUTTON_FROM_STORAGE)))); buttons.add(addButton(new ImageButton(x0+49, y0+34, 9,17, 219,34, 17, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_FROM_STORAGE))));
buttons.add(addButton(new ImageButton(x0+49, y0+52, 9,17, 208,16, 17, BACKGROUND, (bt)->action(BUTTON_TO_STORAGE)))); buttons.add(addButton(new ImageButton(x0+49, y0+52, 9,17, 208,16, 17, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_TO_STORAGE))));
buttons.add(addButton(new ImageButton(x0+77, y0+71, 17, 9, 198,71, 9, BACKGROUND, (bt)->action(BUTTON_FROM_PLAYER)))); buttons.add(addButton(new ImageButton(x0+77, y0+71, 17, 9, 198,71, 9, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_FROM_PLAYER))));
buttons.add(addButton(new ImageButton(x0+59, y0+71, 17, 9, 180,71, 9, BACKGROUND, (bt)->action(BUTTON_TO_PLAYER)))); buttons.add(addButton(new ImageButton(x0+59, y0+71, 17, 9, 180,71, 9, BACKGROUND, (bt)->action(CraftingTableContainer.BUTTON_TO_PLAYER))));
} }
} }
} }
@ -1253,14 +1254,14 @@ public class BlockDecorCraftingTable
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("containerslot", slotId); nbt.putInt("containerslot", slotId);
if(Auxiliaries.isCtrlDown()) nbt.putBoolean("move-all", true); if(Auxiliaries.isCtrlDown()) nbt.putBoolean("move-all", true);
action(ACTION_PLACE_SHIFTCLICKED_STACK, nbt); action(CraftingTableContainer.ACTION_PLACE_SHIFTCLICKED_STACK, nbt);
return; return;
} else if(Auxiliaries.isCtrlDown()) { } else if(Auxiliaries.isCtrlDown()) {
// Move all same items from the inventory of the clicked slot // Move all same items from the inventory of the clicked slot
// (or the crafting grid) to the corresponding target inventory. // (or the crafting grid) to the corresponding target inventory.
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("containerslot", slotId); nbt.putInt("containerslot", slotId);
action(ACTION_MOVE_ALL_STACKS, nbt); action(CraftingTableContainer.ACTION_MOVE_ALL_STACKS, nbt);
return; return;
} else { } else {
// Let the normal slot click handle that. // Let the normal slot click handle that.
@ -1286,16 +1287,16 @@ public class BlockDecorCraftingTable
if((count < resultSlot.getStack().getMaxStackSize()) && (count < resultSlot.getSlotStackLimit())) { if((count < resultSlot.getStack().getMaxStackSize()) && (count < resultSlot.getSlotStackLimit())) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
if(limit > 1) nbt.putInt("limit", limit); if(limit > 1) nbt.putInt("limit", limit);
action(ACTION_INCREASE_CRAFTING_STACKS, nbt); action(CraftingTableContainer.ACTION_INCREASE_CRAFTING_STACKS, nbt);
} }
} else if(!getContainer().history().current().isEmpty()) { } else if(!getContainer().history().current().isEmpty()) {
action(ACTION_PLACE_CURRENT_HISTORY_SEL); action(CraftingTableContainer.ACTION_PLACE_CURRENT_HISTORY_SEL);
} }
} else if(wheel_inc < -0.1) { } else if(wheel_inc < -0.1) {
if(count > 0) { if(count > 0) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
if(limit > 1) nbt.putInt("limit", limit); if(limit > 1) nbt.putInt("limit", limit);
action(ACTION_DECREASE_CRAFTING_STACKS, nbt); action(CraftingTableContainer.ACTION_DECREASE_CRAFTING_STACKS, nbt);
} }
} }
return true; return true;
@ -1306,7 +1307,7 @@ public class BlockDecorCraftingTable
if((getContainer().history().current().isEmpty())) return; if((getContainer().history().current().isEmpty())) return;
final Slot resultSlot = this.getSlotUnderMouse(); // double check final Slot resultSlot = this.getSlotUnderMouse(); // double check
if(!(resultSlot instanceof CraftingResultSlot)) return; if(!(resultSlot instanceof CraftingResultSlot)) return;
action(ACTION_PLACE_CURRENT_HISTORY_SEL); action(CraftingTableContainer.ACTION_PLACE_CURRENT_HISTORY_SEL);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorDoubleGate.java * @file EdDoubleGateBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -30,7 +30,7 @@ import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
public class BlockDecorDoubleGate extends BlockDecor.HorizontalWaterLoggable implements IDecorBlock public class EdDoubleGateBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock
{ {
public static final IntegerProperty SEGMENT = IntegerProperty.create("segment", 0, 1); public static final IntegerProperty SEGMENT = IntegerProperty.create("segment", 0, 1);
public static final BooleanProperty OPEN = FenceGateBlock.OPEN; public static final BooleanProperty OPEN = FenceGateBlock.OPEN;
@ -38,10 +38,10 @@ public class BlockDecorDoubleGate extends BlockDecor.HorizontalWaterLoggable imp
public static final int SEGMENT_UPPER = 1; public static final int SEGMENT_UPPER = 1;
protected final ArrayList<VoxelShape> collision_shapes_; protected final ArrayList<VoxelShape> collision_shapes_;
public BlockDecorDoubleGate(long config, Block.Properties properties, AxisAlignedBB aabb) public EdDoubleGateBlock(long config, Block.Properties properties, AxisAlignedBB aabb)
{ this(config, properties, new AxisAlignedBB[]{aabb}); } { this(config, properties, new AxisAlignedBB[]{aabb}); }
public BlockDecorDoubleGate(long config, Block.Properties properties, AxisAlignedBB[] aabbs) public EdDoubleGateBlock(long config, Block.Properties properties, AxisAlignedBB[] aabbs)
{ {
super(config, properties, aabbs); super(config, properties, aabbs);
AxisAlignedBB[] caabbs = new AxisAlignedBB[aabbs.length]; AxisAlignedBB[] caabbs = new AxisAlignedBB[aabbs.length];

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorDropper.java * @file EdDropper.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -57,133 +57,140 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBlock public class EdDropper
{ {
public static final BooleanProperty OPEN = DoorBlock.OPEN; //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorDropper(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public static class DropperBlock extends DecorBlock.Directed implements IDecorBlock
{ super(config, builder, unrotatedAABB); }
@Override
public RenderTypeHint getRenderTypeHint()
{ return RenderTypeHint.SOLID; }
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
{ return VoxelShapes.fullCube(); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(OPEN); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(OPEN, false); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorDropper.BTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{ {
if(world.isRemote) return; public static final BooleanProperty OPEN = DoorBlock.OPEN;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorDropper.BTileEntity)) return;
((BlockDecorDropper.BTileEntity)te).readnbt(te_nbt, false);
((BlockDecorDropper.BTileEntity)te).reset_rtstate();
((BlockDecorDropper.BTileEntity)te).markDirty();
}
@Override public DropperBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
public boolean hasDynamicDropList() { super(config, builder, unrotatedAABB); }
{ return true; }
@Override @Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) public RenderTypeHint getRenderTypeHint()
{ { return RenderTypeHint.SOLID; }
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; @Override
final TileEntity te = world.getTileEntity(pos); public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
if(!(te instanceof BTileEntity)) return stacks; { return VoxelShapes.fullCube(); }
if(!explosion) {
ItemStack stack = new ItemStack(this, 1); @Override
CompoundNBT te_nbt = ((BTileEntity) te).clear_getnbt(); protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
if(!te_nbt.isEmpty()) { { super.fillStateContainer(builder); builder.add(OPEN); }
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt); @Override
stack.setTag(nbt); @Nullable
} public BlockState getStateForPlacement(BlockItemUseContext context)
stacks.add(stack); { return super.getStateForPlacement(context).with(OPEN, false); }
} else {
for(ItemStack stack: ((BTileEntity)te).stacks_) { @Override
if(!stack.isEmpty()) stacks.add(stack); @SuppressWarnings("deprecation")
} public boolean hasComparatorInputOverride(BlockState state)
((BTileEntity)te).reset_rtstate(); { return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new EdDropper.DropperTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof EdDropper.DropperTileEntity)) return;
((EdDropper.DropperTileEntity)te).readnbt(te_nbt, false);
((EdDropper.DropperTileEntity)te).reset_rtstate();
((EdDropper.DropperTileEntity)te).markDirty();
} }
return stacks;
@Override
public boolean hasDynamicDropList()
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DropperTileEntity)) return stacks;
if(!explosion) {
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((DropperTileEntity) te).clear_getnbt();
if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt);
stack.setTag(nbt);
}
stacks.add(stack);
} else {
for(ItemStack stack: ((DropperTileEntity)te).stacks_) {
if(!stack.isEmpty()) stacks.add(stack);
}
((DropperTileEntity)te).reset_rtstate();
}
return stacks;
}
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof EdDropper.DropperTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DropperTileEntity)) return;
((DropperTileEntity)te).block_updated();
}
@Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
@Override
@SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
} }
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorDropper.BTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).block_updated();
}
@Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
@Override
@SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory public static class DropperTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory
{ {
public static final int NUM_OF_FIELDS = 16; public static final int NUM_OF_FIELDS = 16;
public static final int TICK_INTERVAL = 32; public static final int TICK_INTERVAL = 32;
@ -224,10 +231,10 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
// ModEngineersDecor.logger.info("Config factory dropper:"); // ModEngineersDecor.logger.info("Config factory dropper:");
} }
public BTileEntity() public DropperTileEntity()
{ this(ModContent.TET_FACTORY_DROPPER); } { this(ModContent.TET_FACTORY_DROPPER); }
public BTileEntity(TileEntityType<?> te_type) public DropperTileEntity(TileEntityType<?> te_type)
{ {
super(te_type); super(te_type);
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
@ -335,7 +342,7 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new DropperContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------------------- // IInventory -------------------------------------------------------------------------------------------
@ -398,7 +405,7 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(BTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(DropperTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
@ -513,10 +520,10 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
BlockState update_blockstate() BlockState update_blockstate()
{ {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if(!(state.getBlock() instanceof BlockDecorDropper)) return null; if(!(state.getBlock() instanceof DropperBlock)) return null;
boolean open = (open_timer_ > 0); boolean open = (open_timer_ > 0);
if(state.get(OPEN) != open) { if(state.get(DropperBlock.OPEN) != open) {
state = state.with(OPEN, open); state = state.with(DropperBlock.OPEN, open);
world.setBlockState(pos, state, 2|16); world.setBlockState(pos, state, 2|16);
if((drop_logic_ & DROPLOGIC_SILENT_OPEN) == 0) { if((drop_logic_ & DROPLOGIC_SILENT_OPEN) == 0) {
if(open) { if(open) {
@ -651,7 +658,7 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
for(int i = 0; i < drop_stacks.length; ++i) { for(int i = 0; i < drop_stacks.length; ++i) {
if(drop_stacks[i].isEmpty()) continue; if(drop_stacks[i].isEmpty()) continue;
dirty = true; dirty = true;
drop(world, pos, state.get(FACING), drop_stacks[i], drop_speed_, drop_xdev_, drop_ydev_, drop_noise_); drop(world, pos, state.get(DropperBlock.FACING), drop_stacks[i], drop_speed_, drop_xdev_, drop_ydev_, drop_noise_);
dropped = true; dropped = true;
} }
// cooldown // cooldown
@ -672,12 +679,12 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BContainer extends Container implements Networking.INetworkSynchronisableContainer public static class DropperContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
private static final int PLAYER_INV_START_SLOTNO = BTileEntity.NUM_OF_SLOTS; private static final int PLAYER_INV_START_SLOTNO = DropperTileEntity.NUM_OF_SLOTS;
private final PlayerEntity player_; private final PlayerEntity player_;
private final IInventory inventory_; private final IInventory inventory_;
private final IWorldPosCallable wpc_; private final IWorldPosCallable wpc_;
@ -685,10 +692,10 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
public final int field(int index) { return fields_.get(index); } public final int field(int index) { return fields_.get(index); }
public BContainer(int cid, PlayerInventory player_inventory) public DropperContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(BTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(BTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(DropperTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(DropperTileEntity.NUM_OF_FIELDS)); }
private BContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private DropperContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_FACTORY_DROPPER, cid); super(ModContent.CT_FACTORY_DROPPER, cid);
fields_ = fields; fields_ = fields;
@ -735,7 +742,7 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player slot // Player slot
if(!mergeItemStack(slot_stack, 0, BTileEntity.INPUT_SLOTS_SIZE, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, 0, DropperTileEntity.INPUT_SLOTS_SIZE, false)) return ItemStack.EMPTY;
} else { } else {
// invalid slot // invalid slot
return ItemStack.EMPTY; return ItemStack.EMPTY;
@ -771,12 +778,12 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
@Override @Override
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
{ {
if(!(inventory_ instanceof BTileEntity)) return; if(!(inventory_ instanceof DropperTileEntity)) return;
BTileEntity te = (BTileEntity)inventory_; DropperTileEntity te = (DropperTileEntity)inventory_;
if(nbt.contains("drop_speed")) te.drop_speed_ = MathHelper.clamp(nbt.getInt("drop_speed"), 0, 100); if(nbt.contains("drop_speed")) te.drop_speed_ = MathHelper.clamp(nbt.getInt("drop_speed"), 0, 100);
if(nbt.contains("drop_xdev")) te.drop_xdev_ = MathHelper.clamp(nbt.getInt("drop_xdev"), -100, 100); if(nbt.contains("drop_xdev")) te.drop_xdev_ = MathHelper.clamp(nbt.getInt("drop_xdev"), -100, 100);
if(nbt.contains("drop_ydev")) te.drop_ydev_ = MathHelper.clamp(nbt.getInt("drop_ydev"), -100, 100); if(nbt.contains("drop_ydev")) te.drop_ydev_ = MathHelper.clamp(nbt.getInt("drop_ydev"), -100, 100);
if(nbt.contains("drop_count")) te.drop_count_ = MathHelper.clamp(nbt.getInt("drop_count"), 1, BTileEntity.MAX_DROP_COUNT); if(nbt.contains("drop_count")) te.drop_count_ = MathHelper.clamp(nbt.getInt("drop_count"), 1, DropperTileEntity.MAX_DROP_COUNT);
if(nbt.contains("drop_period")) te.drop_period_ = MathHelper.clamp(nbt.getInt("drop_period"), 0, 100); if(nbt.contains("drop_period")) te.drop_period_ = MathHelper.clamp(nbt.getInt("drop_period"), 0, 100);
if(nbt.contains("drop_logic")) te.drop_logic_ = nbt.getInt("drop_logic"); if(nbt.contains("drop_logic")) te.drop_logic_ = nbt.getInt("drop_logic");
if(nbt.contains("manual_rstrigger") && (nbt.getInt("manual_rstrigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; } if(nbt.contains("manual_rstrigger") && (nbt.getInt("manual_rstrigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; }
@ -791,11 +798,11 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class BGui extends ContainerScreen<BContainer> public static class DropperGui extends ContainerScreen<DropperContainer>
{ {
protected final PlayerEntity player_; protected final PlayerEntity player_;
public BGui(BContainer container, PlayerInventory player_inventory, ITextComponent title) public DropperGui(DropperContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -813,7 +820,7 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
{ {
BContainer container = (BContainer)getContainer(); DropperContainer container = (DropperContainer)getContainer();
int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5); int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5);
if((!isPointInRegion(114, 1, 61, 79, mouseX, mouseY))) { if((!isPointInRegion(114, 1, 61, 79, mouseX, mouseY))) {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
@ -836,7 +843,7 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
} else if(ndrop >= 34) { } else if(ndrop >= 34) {
ndrop = container.field(4) + 1; // + ndrop = container.field(4) + 1; // +
} else { } else {
ndrop = MathHelper.clamp(1+ndrop, 1, BTileEntity.MAX_DROP_COUNT); // slider ndrop = MathHelper.clamp(1+ndrop, 1, DropperTileEntity.MAX_DROP_COUNT); // slider
} }
container.onGuiAction("drop_count", ndrop); container.onGuiAction("drop_count", ndrop);
} else if(isPointInRegion(129, 50, 44, 10, mouseX, mouseY)) { } else if(isPointInRegion(129, 50, 44, 10, mouseX, mouseY)) {
@ -853,11 +860,11 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
} else if(isPointInRegion(114, 51, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(114, 51, 9, 9, mouseX, mouseY)) {
container.onGuiAction("manual_rstrigger", 1); container.onGuiAction("manual_rstrigger", 1);
} else if(isPointInRegion(162, 66, 7, 9, mouseX, mouseY)) { } else if(isPointInRegion(162, 66, 7, 9, mouseX, mouseY)) {
container.onGuiAction("drop_logic", container.field(5) ^ BTileEntity.DROPLOGIC_CONTINUOUS); container.onGuiAction("drop_logic", container.field(5) ^ DropperTileEntity.DROPLOGIC_CONTINUOUS);
} else if(isPointInRegion(132, 66, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(132, 66, 9, 9, mouseX, mouseY)) {
container.onGuiAction("drop_logic", container.field(5) ^ BTileEntity.DROPLOGIC_FILTER_ANDGATE); container.onGuiAction("drop_logic", container.field(5) ^ DropperTileEntity.DROPLOGIC_FILTER_ANDGATE);
} else if(isPointInRegion(148, 66, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(148, 66, 9, 9, mouseX, mouseY)) {
container.onGuiAction("drop_logic", container.field(5) ^ BTileEntity.DROPLOGIC_EXTERN_ANDGATE); container.onGuiAction("drop_logic", container.field(5) ^ DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE);
} }
return true; return true;
} }
@ -870,7 +877,7 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_dropper_gui.png")); this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_dropper_gui.png"));
final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize(); final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize();
blit(x0, y0, 0, 0, w, h); blit(x0, y0, 0, 0, w, h);
BContainer container = (BContainer)getContainer(); DropperContainer container = (DropperContainer)getContainer();
// active drop slot // active drop slot
{ {
int drop_slot_index = container.field(15); int drop_slot_index = container.field(15);
@ -921,16 +928,16 @@ public class BlockDecorDropper extends BlockDecor.Directed implements IDecorBloc
} }
// trigger logic // trigger logic
{ {
int filter_gate_offset = ((container.field(5) & BTileEntity.DROPLOGIC_FILTER_ANDGATE) != 0) ? 11 : 0; int filter_gate_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_FILTER_ANDGATE) != 0) ? 11 : 0;
int extern_gate_offset = ((container.field(5) & BTileEntity.DROPLOGIC_EXTERN_ANDGATE) != 0) ? 11 : 0; int extern_gate_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_EXTERN_ANDGATE) != 0) ? 11 : 0;
int pulse_mode_offset = ((container.field(5) & BTileEntity.DROPLOGIC_CONTINUOUS ) != 0) ? 10 : 0; int pulse_mode_offset = ((container.field(5) & DropperTileEntity.DROPLOGIC_CONTINUOUS ) != 0) ? 10 : 0;
blit(x0+132, y0+66, 179+filter_gate_offset, 66, 9, 9); blit(x0+132, y0+66, 179+filter_gate_offset, 66, 9, 9);
blit(x0+148, y0+66, 179+extern_gate_offset, 66, 9, 9); blit(x0+148, y0+66, 179+extern_gate_offset, 66, 9, 9);
blit(x0+162, y0+66, 200+pulse_mode_offset, 66, 9, 9); blit(x0+162, y0+66, 200+pulse_mode_offset, 66, 9, 9);
} }
// drop timer running indicator // drop timer running indicator
{ {
if((container.field(9) > BTileEntity.DROP_PERIOD_OFFSET) && ((System.currentTimeMillis() % 1000) < 500)) { if((container.field(9) > DropperTileEntity.DROP_PERIOD_OFFSET) && ((System.currentTimeMillis() % 1000) < 500)) {
blit(x0+149, y0+51, 201, 39, 3, 3); blit(x0+149, y0+51, 201, 39, 3, 3);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFurnaceElectrical.java * @file EdElectricalFurnace.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -8,11 +8,8 @@
*/ */
package wile.engineersdecor.blocks; package wile.engineersdecor.blocks;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.BlockDecorFurnace.DecorFurnaceBlock;
import wile.engineersdecor.blocks.BlockDecorFurnace.DecorFurnaceContainer;
import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.libmc.detail.Inventories;
import wile.engineersdecor.libmc.detail.Networking; import wile.engineersdecor.libmc.detail.Networking;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
@ -61,28 +58,28 @@ import javax.annotation.Nullable;
import java.util.Arrays; import java.util.Arrays;
import java.util.Random; import java.util.Random;
public class BlockDecorFurnaceElectrical public class EdElectricalFurnace
{ {
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceElectricalBlock extends DecorFurnaceBlock implements IDecorBlock public static class ElectricalFurnaceBlock extends EdFurnace.FurnaceBlock implements IDecorBlock
{ {
public DecorFurnaceElectricalBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) public ElectricalFurnaceBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
{ super(config, builder, unrotatedAABBs); } { super(config, builder, unrotatedAABBs); }
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity(); } { return new EdElectricalFurnace.ElectricalFurnaceTileEntity(); }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity)) return ActionResultType.FAIL; if(!(te instanceof EdElectricalFurnace.ElectricalFurnaceTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
player.addStat(Stats.INTERACT_WITH_FURNACE); player.addStat(Stats.INTERACT_WITH_FURNACE);
@ -98,8 +95,8 @@ public class BlockDecorFurnaceElectrical
CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory"); CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory");
if(inventory_nbt.isEmpty()) return; if(inventory_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity)) return; if(!(te instanceof EdElectricalFurnace.ElectricalFurnaceTileEntity)) return;
DecorFurnaceElectricalTileEntity bte = (BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity)te; ElectricalFurnaceTileEntity bte = (EdElectricalFurnace.ElectricalFurnaceTileEntity)te;
bte.readnbt(inventory_nbt); bte.readnbt(inventory_nbt);
bte.markDirty(); bte.markDirty();
world.setBlockState(pos, state.with(LIT, bte.burning())); world.setBlockState(pos, state.with(LIT, bte.burning()));
@ -116,7 +113,7 @@ public class BlockDecorFurnaceElectrical
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceElectricalTileEntity extends BlockDecorFurnace.DecorFurnaceTileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage public static class ElectricalFurnaceTileEntity extends EdFurnace.FurnaceTileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage
{ {
public static final IRecipeType<FurnaceRecipe> RECIPE_TYPE = IRecipeType.SMELTING; public static final IRecipeType<FurnaceRecipe> RECIPE_TYPE = IRecipeType.SMELTING;
public static final int NUM_OF_FIELDS = 7; public static final int NUM_OF_FIELDS = 7;
@ -156,7 +153,7 @@ public class BlockDecorFurnaceElectrical
ModEngineersDecor.logger().info("Config electrical furnace speed:" + proc_speed_percent_ + ", power consumption:" + energy_consumption_); ModEngineersDecor.logger().info("Config electrical furnace speed:" + proc_speed_percent_ + ", power consumption:" + energy_consumption_);
} }
// DecorFurnaceElectricalTileEntity ----------------------------------------------------------------------------- // ElectricalFurnaceTileEntity -----------------------------------------------------------------------------
private int burntime_left_ = 0; private int burntime_left_ = 0;
private int proc_time_elapsed_ = 0; private int proc_time_elapsed_ = 0;
@ -169,10 +166,10 @@ public class BlockDecorFurnaceElectrical
private int fifo_timer_ = 0; private int fifo_timer_ = 0;
private boolean enabled_ = false; private boolean enabled_ = false;
public DecorFurnaceElectricalTileEntity() public ElectricalFurnaceTileEntity()
{ this(ModContent.TET_SMALL_ELECTRICAL_FURNACE); } { this(ModContent.TET_SMALL_ELECTRICAL_FURNACE); }
public DecorFurnaceElectricalTileEntity(TileEntityType<?> te_type) public ElectricalFurnaceTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void reset() public void reset()
@ -250,7 +247,7 @@ public class BlockDecorFurnaceElectrical
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BlockDecorFurnaceElectrical.DecorFurnaceElectricalContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new EdElectricalFurnace.ElectricalFurnaceContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------ // IInventory ------------------------------------------------------------------------------
@ -273,19 +270,19 @@ public class BlockDecorFurnaceElectrical
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(DecorFurnaceElectricalTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(ElectricalFurnaceTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
{ {
switch(id) { switch(id) {
case 0: return DecorFurnaceElectricalTileEntity.this.burntime_left_; case 0: return ElectricalFurnaceTileEntity.this.burntime_left_;
case 1: return DecorFurnaceElectricalTileEntity.this.energy_stored_; case 1: return ElectricalFurnaceTileEntity.this.energy_stored_;
case 2: return DecorFurnaceElectricalTileEntity.this.proc_time_elapsed_; case 2: return ElectricalFurnaceTileEntity.this.proc_time_elapsed_;
case 3: return DecorFurnaceElectricalTileEntity.this.proc_time_needed_; case 3: return ElectricalFurnaceTileEntity.this.proc_time_needed_;
case 4: return DecorFurnaceElectricalTileEntity.this.speed_; case 4: return ElectricalFurnaceTileEntity.this.speed_;
case 5: return DecorFurnaceElectricalTileEntity.this.field_max_energy_stored_; case 5: return ElectricalFurnaceTileEntity.this.field_max_energy_stored_;
case 6: return DecorFurnaceElectricalTileEntity.this.field_isburning_; case 6: return ElectricalFurnaceTileEntity.this.field_isburning_;
default: return 0; default: return 0;
} }
} }
@ -293,13 +290,13 @@ public class BlockDecorFurnaceElectrical
public void set(int id, int value) public void set(int id, int value)
{ {
switch(id) { switch(id) {
case 0: DecorFurnaceElectricalTileEntity.this.burntime_left_ = value; break; case 0: ElectricalFurnaceTileEntity.this.burntime_left_ = value; break;
case 1: DecorFurnaceElectricalTileEntity.this.energy_stored_ = value; break; case 1: ElectricalFurnaceTileEntity.this.energy_stored_ = value; break;
case 2: DecorFurnaceElectricalTileEntity.this.proc_time_elapsed_ = value; break; case 2: ElectricalFurnaceTileEntity.this.proc_time_elapsed_ = value; break;
case 3: DecorFurnaceElectricalTileEntity.this.proc_time_needed_ = value; break; case 3: ElectricalFurnaceTileEntity.this.proc_time_needed_ = value; break;
case 4: DecorFurnaceElectricalTileEntity.this.speed_ = value; break; case 4: ElectricalFurnaceTileEntity.this.speed_ = value; break;
case 5: DecorFurnaceElectricalTileEntity.this.field_max_energy_stored_ = value; break; case 5: ElectricalFurnaceTileEntity.this.field_max_energy_stored_ = value; break;
case 6: DecorFurnaceElectricalTileEntity.this.field_isburning_ = value; break; case 6: ElectricalFurnaceTileEntity.this.field_isburning_ = value; break;
} }
} }
}; };
@ -359,9 +356,9 @@ public class BlockDecorFurnaceElectrical
protected static class BItemHandler implements IItemHandler protected static class BItemHandler implements IItemHandler
{ {
private DecorFurnaceElectricalTileEntity te; private ElectricalFurnaceTileEntity te;
BItemHandler(DecorFurnaceElectricalTileEntity te) BItemHandler(ElectricalFurnaceTileEntity te)
{ this.te = te; } { this.te = te; }
@Override @Override
@ -585,8 +582,8 @@ public class BlockDecorFurnaceElectrical
boolean dirty = false; boolean dirty = false;
if(energy_stored_ < transfer_energy_consumption_) return false; if(energy_stored_ < transfer_energy_consumption_) return false;
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(!(state.getBlock() instanceof DecorFurnaceElectricalBlock)) return false; if(!(state.getBlock() instanceof ElectricalFurnaceBlock)) return false;
final Direction out_facing = state.get(DecorFurnaceElectricalBlock.HORIZONTAL_FACING); final Direction out_facing = state.get(ElectricalFurnaceBlock.HORIZONTAL_FACING);
if(out && (!stacks_.get(FIFO_OUTPUT_1_SLOT_NO).isEmpty())) { if(out && (!stacks_.get(FIFO_OUTPUT_1_SLOT_NO).isEmpty())) {
TileEntity te = world.getTileEntity(pos.offset(out_facing)); TileEntity te = world.getTileEntity(pos.offset(out_facing));
if(te!=null) { if(te!=null) {
@ -600,7 +597,7 @@ public class BlockDecorFurnaceElectrical
} }
} }
if(with_automatic_inventory_pulling_ || is_accepted_hopper(stacks_.get(SMELTING_AUX_SLOT_NO))) { if(with_automatic_inventory_pulling_ || is_accepted_hopper(stacks_.get(SMELTING_AUX_SLOT_NO))) {
final Direction inp_facing = state.get(DecorFurnaceElectricalBlock.HORIZONTAL_FACING).getOpposite(); final Direction inp_facing = state.get(ElectricalFurnaceBlock.HORIZONTAL_FACING).getOpposite();
if(inp && (stacks_.get(FIFO_INPUT_1_SLOT_NO).isEmpty())) { if(inp && (stacks_.get(FIFO_INPUT_1_SLOT_NO).isEmpty())) {
TileEntity te = world.getTileEntity(pos.offset(inp_facing)); TileEntity te = world.getTileEntity(pos.offset(inp_facing));
if(te!=null) { if(te!=null) {
@ -649,18 +646,18 @@ public class BlockDecorFurnaceElectrical
private void sync_blockstate() private void sync_blockstate()
{ {
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if((state.getBlock() instanceof DecorFurnaceElectricalBlock) && (state.get(DecorFurnaceElectricalBlock.LIT) != burning())) { if((state.getBlock() instanceof ElectricalFurnaceBlock) && (state.get(ElectricalFurnaceBlock.LIT) != burning())) {
world.setBlockState(pos, state.with(DecorFurnaceElectricalBlock.LIT, burning()), 2); world.setBlockState(pos, state.with(ElectricalFurnaceBlock.LIT, burning()), 2);
} }
} }
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceElectricalContainer extends Container implements Networking.INetworkSynchronisableContainer public static class ElectricalFurnaceContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
private static final int PLAYER_INV_START_SLOTNO = 7; private static final int PLAYER_INV_START_SLOTNO = 7;
protected final PlayerEntity player_; protected final PlayerEntity player_;
@ -674,24 +671,24 @@ public class BlockDecorFurnaceElectrical
public IInventory inventory() { return inventory_ ; } public IInventory inventory() { return inventory_ ; }
public World world() { return player_.world; } public World world() { return player_.world; }
public DecorFurnaceElectricalContainer(int cid, PlayerInventory player_inventory) public ElectricalFurnaceContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(DecorFurnaceElectricalTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(DecorFurnaceElectricalTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(ElectricalFurnaceTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(ElectricalFurnaceTileEntity.NUM_OF_FIELDS)); }
private DecorFurnaceElectricalContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private ElectricalFurnaceContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_SMALL_ELECTRICAL_FURNACE, cid); super(ModContent.CT_SMALL_ELECTRICAL_FURNACE, cid);
player_ = player_inventory.player; player_ = player_inventory.player;
inventory_ = block_inventory; inventory_ = block_inventory;
wpc_ = wpc; wpc_ = wpc;
fields_ = fields; fields_ = fields;
recipe_type_ = DecorFurnaceElectricalTileEntity.RECIPE_TYPE; recipe_type_ = ElectricalFurnaceTileEntity.RECIPE_TYPE;
addSlot(new Slot(inventory_, 0, 59, 28)); // smelting input addSlot(new Slot(inventory_, 0, 59, 28)); // smelting input
addSlot(new Slot(inventory_, 1, 16, 52)); // aux addSlot(new Slot(inventory_, 1, 16, 52)); // aux
addSlot(new DecorFurnaceContainer.BSlotResult(player_, inventory_, 2, 101, 28)); // smelting result addSlot(new EdFurnace.FurnaceContainer.BSlotResult(player_, inventory_, 2, 101, 28)); // smelting result
addSlot(new DecorFurnaceContainer.BSlotInpFifo(inventory_, 3, 34, 28)); // input fifo 0 addSlot(new EdFurnace.FurnaceContainer.BSlotInpFifo(inventory_, 3, 34, 28)); // input fifo 0
addSlot(new DecorFurnaceContainer.BSlotInpFifo(inventory_, 4, 16, 28)); // input fifo 1 addSlot(new EdFurnace.FurnaceContainer.BSlotInpFifo(inventory_, 4, 16, 28)); // input fifo 1
addSlot(new DecorFurnaceContainer.BSlotOutFifo(player_, inventory_, 5, 126, 28)); // out fifo 0 addSlot(new EdFurnace.FurnaceContainer.BSlotOutFifo(player_, inventory_, 5, 126, 28)); // out fifo 0
addSlot(new DecorFurnaceContainer.BSlotOutFifo(player_, inventory_, 6, 144, 28)); // out fifo 1 addSlot(new EdFurnace.FurnaceContainer.BSlotOutFifo(player_, inventory_, 6, 144, 28)); // out fifo 1
for(int x=0; x<9; ++x) { for(int x=0; x<9; ++x) {
addSlot(new Slot(player_inventory, x, 8+x*18, 144)); // player slots: 0..8 addSlot(new Slot(player_inventory, x, 8+x*18, 144)); // player slots: 0..8
} }
@ -726,7 +723,7 @@ public class BlockDecorFurnaceElectrical
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player inventory // Player inventory
if(DecorFurnaceElectricalTileEntity.canSmelt(world(), slot_stack)) { if(ElectricalFurnaceTileEntity.canSmelt(world(), slot_stack)) {
if( if(
(!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input (!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input
(!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0 (!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0
@ -769,8 +766,8 @@ public class BlockDecorFurnaceElectrical
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
{ {
if(!(inventory_ instanceof DecorFurnaceElectricalTileEntity)) return; if(!(inventory_ instanceof ElectricalFurnaceTileEntity)) return;
DecorFurnaceElectricalTileEntity te = (DecorFurnaceElectricalTileEntity)inventory_; ElectricalFurnaceTileEntity te = (ElectricalFurnaceTileEntity)inventory_;
if(nbt.contains("speed")) te.speed_ = MathHelper.clamp(nbt.getInt("speed"), 0, 3); if(nbt.contains("speed")) te.speed_ = MathHelper.clamp(nbt.getInt("speed"), 0, 3);
te.markDirty(); te.markDirty();
} }
@ -781,11 +778,11 @@ public class BlockDecorFurnaceElectrical
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class DecorFurnaceElectrical extends ContainerScreen<DecorFurnaceElectricalContainer> public static class ElectricalFurnaceGui extends ContainerScreen<ElectricalFurnaceContainer>
{ {
protected final PlayerEntity player_; protected final PlayerEntity player_;
public DecorFurnaceElectrical(DecorFurnaceElectricalContainer container, PlayerInventory player_inventory, ITextComponent title) public ElectricalFurnaceGui(ElectricalFurnaceContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -829,7 +826,7 @@ public class BlockDecorFurnaceElectrical
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
{ {
DecorFurnaceElectricalContainer container = (DecorFurnaceElectricalContainer)getContainer(); ElectricalFurnaceContainer container = (ElectricalFurnaceContainer)getContainer();
int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5); int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5);
if((!isPointInRegion(136, 48, 28, 28, mouseX, mouseY))) { if((!isPointInRegion(136, 48, 28, 28, mouseX, mouseY))) {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
@ -850,7 +847,7 @@ public class BlockDecorFurnaceElectrical
private int heat_px(int pixels) private int heat_px(int pixels)
{ {
int k = ((getContainer().field(0) * (pixels+1)) / (BlockDecorFurnaceElectrical.DecorFurnaceElectricalTileEntity.HEAT_CAPACITY)); int k = ((getContainer().field(0) * (pixels+1)) / (EdElectricalFurnace.ElectricalFurnaceTileEntity.HEAT_CAPACITY));
return (k < pixels) ? k : pixels; return (k < pixels) ? k : pixels;
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorWall.java * @file EdFenceBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -8,22 +8,22 @@
*/ */
package wile.engineersdecor.blocks; package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.StandardFenceBlock;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import wile.engineersdecor.libmc.blocks.StandardFenceBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
public class BlockDecorFence extends StandardFenceBlock implements IDecorBlock
public class EdFenceBlock extends StandardFenceBlock implements IDecorBlock
{ {
public BlockDecorFence(long config, Block.Properties properties) public EdFenceBlock(long config, Block.Properties properties)
{ super(config, properties); } { super(config, properties); }
public BlockDecorFence(long config, Block.Properties properties, double pole_width, double pole_height, double side_width, double side_max_y, double side_min_y) public EdFenceBlock(long config, Block.Properties properties, double pole_width, double pole_height, double side_width, double side_max_y, double side_min_y)
{ super(config, properties, pole_width, pole_height, side_width, side_max_y, side_min_y); } { super(config, properties, pole_width, pole_height, side_width, side_max_y, side_min_y); }
@Override @Override
protected boolean attachesTo(BlockState facingState, IWorldReader world, BlockPos facingPos, Direction side) protected boolean attachesTo(BlockState facingState, IWorldReader world, BlockPos facingPos, Direction side)
{ return ((facingState.getBlock()) instanceof BlockDecorDoubleGate) || super.attachesTo(facingState, world, facingPos, side); } { return ((facingState.getBlock()) instanceof EdDoubleGateBlock) || super.attachesTo(facingState, world, facingPos, side); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFloorGrating.java * @file EdFloorGratingBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -20,9 +20,9 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockDecorFloorGrating extends BlockDecor.WaterLoggable implements IDecorBlock public class EdFloorGratingBlock extends DecorBlock.WaterLoggable implements IDecorBlock
{ {
public BlockDecorFloorGrating(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdFloorGratingBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorPassiveFluidAccumulator.java * @file EdFluidAccumulator.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -41,44 +41,51 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorPassiveFluidAccumulator extends BlockDecor.Directed implements IDecorBlock public class EdFluidAccumulator
{ {
public BlockDecorPassiveFluidAccumulator(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) //--------------------------------------------------------------------------------------------------------------------
{ super(config, builder, unrotatedAABB); } // Block
//--------------------------------------------------------------------------------------------------------------------
@Override public static class FluidAccumulatorBlock extends DecorBlock.Directed implements IDecorBlock
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorPassiveFluidAccumulator.BTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; public FluidAccumulatorBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
TileEntity te = world.getTileEntity(pos); { super(config, builder, unrotatedAABB); }
if(!(te instanceof BTileEntity)) return ActionResultType.FAIL;
((BTileEntity)te).send_device_stats(player);
return ActionResultType.SUCCESS;
}
@Override @Override
@SuppressWarnings("deprecation") public boolean hasTileEntity(BlockState state)
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) { return true; }
{
TileEntity te = world.getTileEntity(pos); @Override
if(te instanceof BTileEntity) ((BTileEntity)te).block_changed(); @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new EdFluidAccumulator.FluidAccumulatorTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidAccumulatorTileEntity)) return ActionResultType.FAIL;
((FluidAccumulatorTileEntity)te).send_device_stats(player);
return ActionResultType.SUCCESS;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof FluidAccumulatorTileEntity) ((FluidAccumulatorTileEntity)te).block_changed();
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider public static class FluidAccumulatorTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider
{ {
protected static int tick_idle_interval = 20; // ca 1000ms, simulates suction delay and saves CPU when not drained. protected static int tick_idle_interval = 20; // ca 1000ms, simulates suction delay and saves CPU when not drained.
protected static int max_flowrate = 1000; protected static int max_flowrate = 1000;
@ -103,10 +110,10 @@ public class BlockDecorPassiveFluidAccumulator extends BlockDecor.Directed imple
// TileEntity ------------------------------------------------------------------------------ // TileEntity ------------------------------------------------------------------------------
public BTileEntity() public FluidAccumulatorTileEntity()
{ this(ModContent.TET_PASSIVE_FLUID_ACCUMULATOR); } { this(ModContent.TET_PASSIVE_FLUID_ACCUMULATOR); }
public BTileEntity(TileEntityType<?> te_type) public FluidAccumulatorTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
@Override @Override
@ -136,8 +143,8 @@ public class BlockDecorPassiveFluidAccumulator extends BlockDecor.Directed imple
private static class InputFillHandler implements IFluidHandler private static class InputFillHandler implements IFluidHandler
{ {
private final BTileEntity parent_; private final FluidAccumulatorTileEntity parent_;
InputFillHandler(BTileEntity parent) { parent_ = parent; } InputFillHandler(FluidAccumulatorTileEntity parent) { parent_ = parent; }
@Override public int getTanks() { return 0; } @Override public int getTanks() { return 0; }
@Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; } @Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; }
@Override public int getTankCapacity(int tank) { return max_flowrate; } @Override public int getTankCapacity(int tank) { return max_flowrate; }
@ -151,8 +158,8 @@ public class BlockDecorPassiveFluidAccumulator extends BlockDecor.Directed imple
private static class OutputFlowHandler implements IFluidHandler private static class OutputFlowHandler implements IFluidHandler
{ {
private final BTileEntity te; private final FluidAccumulatorTileEntity te;
OutputFlowHandler(BTileEntity parent) { te = parent; } OutputFlowHandler(FluidAccumulatorTileEntity parent) { te = parent; }
@Override public int getTanks() { return 1; } @Override public int getTanks() { return 1; }
@Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); } @Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); }
@Override public int getTankCapacity(int tank) { return max_flowrate; } @Override public int getTankCapacity(int tank) { return max_flowrate; }
@ -208,8 +215,8 @@ public class BlockDecorPassiveFluidAccumulator extends BlockDecor.Directed imple
if(!initialized_) { if(!initialized_) {
initialized_ = true; initialized_ = true;
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if((state==null) || (!(state.getBlock() instanceof BlockDecorPassiveFluidAccumulator))) return; if((state==null) || (!(state.getBlock() instanceof FluidAccumulatorBlock))) return;
block_facing_ = state.get(FACING); block_facing_ = state.get(FluidAccumulatorBlock.FACING);
} }
int n_requested = last_drain_request_amount_; int n_requested = last_drain_request_amount_;
last_drain_request_amount_ = 0; last_drain_request_amount_ = 0;
@ -237,7 +244,7 @@ public class BlockDecorPassiveFluidAccumulator extends BlockDecor.Directed imple
final Direction f = Direction.byIndex(round_robin_); final Direction f = Direction.byIndex(round_robin_);
if(f == block_facing_) continue; if(f == block_facing_) continue;
final TileEntity te = world.getTileEntity(pos.offset(f)); final TileEntity te = world.getTileEntity(pos.offset(f));
if((te==null) || (te instanceof BTileEntity)) continue; if((te==null) || (te instanceof FluidAccumulatorTileEntity)) continue;
final IFluidHandler fh = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, f.getOpposite()).orElse(null); final IFluidHandler fh = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, f.getOpposite()).orElse(null);
if(fh==null) continue; if(fh==null) continue;
if(tank_.isEmpty()) { if(tank_.isEmpty()) {

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFluidFunnel.java * @file EdFluidFunnel.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -42,106 +42,113 @@ import javax.annotation.Nullable;
import java.util.*; import java.util.*;
public class BlockDecorFluidFunnel extends BlockDecor implements IDecorBlock public class EdFluidFunnel
{ {
public static final int FILL_LEVEL_MAX = 3; //--------------------------------------------------------------------------------------------------------------------
public static final IntegerProperty FILL_LEVEL = IntegerProperty.create("level", 0, FILL_LEVEL_MAX); // Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorFluidFunnel(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) public static class FluidFunnelBlock extends DecorBlock.Normal implements IDecorBlock
{ super(config, builder, unrotatedAABB); }
@Override
public RenderTypeHint getRenderTypeHint()
{ return RenderTypeHint.CUTOUT; }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(FILL_LEVEL); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(FILL_LEVEL, 0); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos)
{ return MathHelper.clamp((state.get(FILL_LEVEL)*5), 0, 15); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{ {
if(world.isRemote) return; public static final int FILL_LEVEL_MAX = 3;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return; public static final IntegerProperty FILL_LEVEL = IntegerProperty.create("level", 0, FILL_LEVEL_MAX);
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).readnbt(te_nbt);
((BTileEntity)te).markDirty();
world.setBlockState(pos, state.with(FILL_LEVEL, 0));
}
@Override public FluidFunnelBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
public boolean hasDynamicDropList() { super(config, builder, unrotatedAABB); }
{ return true; }
@Override @Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) public RenderTypeHint getRenderTypeHint()
{ { return RenderTypeHint.CUTOUT; }
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; @Override
final TileEntity te = world.getTileEntity(pos); protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
if(!(te instanceof BTileEntity)) return stacks; { super.fillStateContainer(builder); builder.add(FILL_LEVEL); }
if(!explosion) {
ItemStack stack = new ItemStack(this, 1); @Override
CompoundNBT te_nbt = new CompoundNBT(); @Nullable
((BTileEntity)te).writenbt(te_nbt); public BlockState getStateForPlacement(BlockItemUseContext context)
if(!te_nbt.isEmpty()) { { return super.getStateForPlacement(context).with(FILL_LEVEL, 0); }
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt); @Override
stack.setTag(nbt); public boolean hasTileEntity(BlockState state)
} { return true; }
stacks.add(stack);
} else { @Override
stacks.add(new ItemStack(this, 1)); @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new FluidFunnelTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos)
{ return MathHelper.clamp((state.get(FILL_LEVEL)*5), 0, 15); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidFunnelTileEntity)) return;
((FluidFunnelTileEntity)te).readnbt(te_nbt);
((FluidFunnelTileEntity)te).markDirty();
world.setBlockState(pos, state.with(FILL_LEVEL, 0));
} }
return stacks;
}
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public boolean hasDynamicDropList()
{ { return true; }
if(world.isRemote) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return ActionResultType.FAIL;
return FluidUtil.interactWithFluidHandler(player, hand, world, pos, rayTraceResult.getFace()) ? ActionResultType.SUCCESS : ActionResultType.FAIL;
}
@Override @Override
@SuppressWarnings("deprecation") public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) {
{ TileEntity te = world.getTileEntity(pos); if(te instanceof BTileEntity) ((BTileEntity)te).block_changed(); } final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidFunnelTileEntity)) return stacks;
if(!explosion) {
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = new CompoundNBT();
((FluidFunnelTileEntity)te).writenbt(te_nbt);
if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt);
stack.setTag(nbt);
}
stacks.add(stack);
} else {
stacks.add(new ItemStack(this, 1));
}
return stacks;
}
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidFunnelTileEntity)) return ActionResultType.FAIL;
return FluidUtil.interactWithFluidHandler(player, hand, world, pos, rayTraceResult.getFace()) ? ActionResultType.SUCCESS : ActionResultType.FAIL;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{ TileEntity te = world.getTileEntity(pos); if(te instanceof FluidFunnelTileEntity) ((FluidFunnelTileEntity)te).block_changed(); }
}
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider, IFluidTank public static class FluidFunnelTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider, IFluidTank
{ {
public static final int TANK_CAPACITY = 3000; public static final int TANK_CAPACITY = 3000;
public static final int TICK_INTERVAL = 10; // ca 500ms public static final int TICK_INTERVAL = 10; // ca 500ms
@ -163,10 +170,10 @@ public class BlockDecorFluidFunnel extends BlockDecor implements IDecorBlock
public void block_changed() public void block_changed()
{ tick_timer_ = TICK_INTERVAL; } // collect after flowing fluid has a stable state, otherwise it looks odd. { tick_timer_ = TICK_INTERVAL; } // collect after flowing fluid has a stable state, otherwise it looks odd.
public BTileEntity() public FluidFunnelTileEntity()
{ this(ModContent.TET_SMALL_FLUID_FUNNEL); } { this(ModContent.TET_SMALL_FLUID_FUNNEL); }
public BTileEntity(TileEntityType<?> te_type) public FluidFunnelTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void readnbt(CompoundNBT nbt) public void readnbt(CompoundNBT nbt)
@ -200,8 +207,8 @@ public class BlockDecorFluidFunnel extends BlockDecor implements IDecorBlock
private static class OutputFluidHandler implements IFluidHandler private static class OutputFluidHandler implements IFluidHandler
{ {
private final BTileEntity te; private final FluidFunnelTileEntity te;
OutputFluidHandler(BTileEntity parent) { te = parent; } OutputFluidHandler(FluidFunnelTileEntity parent) { te = parent; }
@Override public int getTanks() { return 1; } @Override public int getTanks() { return 1; }
@Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); } @Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); }
@Override public int getTankCapacity(int tank) { return TANK_CAPACITY; } @Override public int getTankCapacity(int tank) { return TANK_CAPACITY; }
@ -418,9 +425,9 @@ public class BlockDecorFluidFunnel extends BlockDecor implements IDecorBlock
} }
} }
// Block state // Block state
int fill_level = (tank_==null) ? 0 : (MathHelper.clamp(tank_.getAmount()/1000,0,FILL_LEVEL_MAX)); int fill_level = (tank_==null) ? 0 : (MathHelper.clamp(tank_.getAmount()/1000,0, FluidFunnelBlock.FILL_LEVEL_MAX));
final BlockState funnel_state = world.getBlockState(pos); final BlockState funnel_state = world.getBlockState(pos);
if(funnel_state.get(FILL_LEVEL) != fill_level) world.setBlockState(pos, funnel_state.with(FILL_LEVEL, fill_level), 2|16); if(funnel_state.get(FluidFunnelBlock.FILL_LEVEL) != fill_level) world.setBlockState(pos, funnel_state.with(FluidFunnelBlock.FILL_LEVEL, fill_level), 2|16);
if(dirty) markDirty(); if(dirty) markDirty();
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockFurnace.java * @file EdFurnace.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -10,7 +10,7 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ExtItems; import wile.engineersdecor.detail.ExternalObjects;
import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.libmc.detail.Inventories;
import wile.engineersdecor.libmc.detail.Networking; import wile.engineersdecor.libmc.detail.Networking;
import net.minecraft.tileentity.*; import net.minecraft.tileentity.*;
@ -63,17 +63,17 @@ import javax.annotation.Nullable;
import java.util.*; import java.util.*;
public class BlockDecorFurnace public class EdFurnace
{ {
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceBlock extends BlockDecor.Horizontal implements IDecorBlock public static class FurnaceBlock extends DecorBlock.Horizontal implements IDecorBlock
{ {
public static final BooleanProperty LIT = RedstoneTorchBlock.LIT; public static final BooleanProperty LIT = RedstoneTorchBlock.LIT;
public DecorFurnaceBlock(long config, Block.Properties properties, final AxisAlignedBB[] unrotatedAABB) public FurnaceBlock(long config, Block.Properties properties, final AxisAlignedBB[] unrotatedAABB)
{ super(config, properties, unrotatedAABB); setDefaultState(super.getDefaultState().with(LIT, false)); } { super(config, properties, unrotatedAABB); setDefaultState(super.getDefaultState().with(LIT, false)); }
@Override @Override
@ -100,7 +100,7 @@ public class BlockDecorFurnace
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos) public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ {
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
return (te instanceof DecorFurnaceTileEntity) ? ((DecorFurnaceTileEntity)te).getComparatorOutput() : 0; return (te instanceof FurnaceTileEntity) ? ((FurnaceTileEntity)te).getComparatorOutput() : 0;
} }
@Override @Override
@ -110,7 +110,7 @@ public class BlockDecorFurnace
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorFurnace.DecorFurnaceTileEntity(); } { return new FurnaceTileEntity(); }
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
@ -121,8 +121,8 @@ public class BlockDecorFurnace
CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory"); CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory");
if(inventory_nbt.isEmpty()) return; if(inventory_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorFurnace.DecorFurnaceTileEntity)) return; if(!(te instanceof FurnaceTileEntity)) return;
final BlockDecorFurnace.DecorFurnaceTileEntity bte = ((BlockDecorFurnace.DecorFurnaceTileEntity)te); final FurnaceTileEntity bte = ((FurnaceTileEntity)te);
bte.readnbt(inventory_nbt); bte.readnbt(inventory_nbt);
bte.markDirty(); bte.markDirty();
world.setBlockState(pos, state.with(LIT, bte.burning())); world.setBlockState(pos, state.with(LIT, bte.burning()));
@ -137,10 +137,10 @@ public class BlockDecorFurnace
final List<ItemStack> stacks = new ArrayList<ItemStack>(); final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorFurnaceTileEntity)) return stacks; if(!(te instanceof FurnaceTileEntity)) return stacks;
if(!explosion) { if(!explosion) {
ItemStack stack = new ItemStack(this, 1); ItemStack stack = new ItemStack(this, 1);
CompoundNBT inventory_nbt = ((DecorFurnaceTileEntity)te).reset_getnbt(); CompoundNBT inventory_nbt = ((FurnaceTileEntity)te).reset_getnbt();
if(!inventory_nbt.isEmpty()) { if(!inventory_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.put("inventory", inventory_nbt); nbt.put("inventory", inventory_nbt);
@ -148,8 +148,8 @@ public class BlockDecorFurnace
} }
stacks.add(stack); stacks.add(stack);
} else { } else {
for(ItemStack stack: ((DecorFurnaceTileEntity)te).stacks_) stacks.add(stack); for(ItemStack stack: ((FurnaceTileEntity)te).stacks_) stacks.add(stack);
((DecorFurnaceTileEntity)te).reset(); ((FurnaceTileEntity)te).reset();
} }
return stacks; return stacks;
} }
@ -159,7 +159,7 @@ public class BlockDecorFurnace
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorFurnace.DecorFurnaceTileEntity)) return ActionResultType.FAIL; if(!(te instanceof FurnaceTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
player.addStat(Stats.INTERACT_WITH_FURNACE); player.addStat(Stats.INTERACT_WITH_FURNACE);
@ -190,7 +190,7 @@ public class BlockDecorFurnace
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage public static class FurnaceTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage
{ {
public static final IRecipeType<FurnaceRecipe> RECIPE_TYPE = IRecipeType.SMELTING; public static final IRecipeType<FurnaceRecipe> RECIPE_TYPE = IRecipeType.SMELTING;
public static final int NUM_OF_FIELDS = 5; public static final int NUM_OF_FIELDS = 5;
@ -243,10 +243,10 @@ public class BlockDecorFurnace
protected @Nullable IRecipe current_recipe_ = null; protected @Nullable IRecipe current_recipe_ = null;
private final List<String> recent_recipes_ = new ArrayList<>(); private final List<String> recent_recipes_ = new ArrayList<>();
public DecorFurnaceTileEntity() public FurnaceTileEntity()
{ this(ModContent.TET_SMALL_LAB_FURNACE); } { this(ModContent.TET_SMALL_LAB_FURNACE); }
public DecorFurnaceTileEntity(TileEntityType<?> te_type) public FurnaceTileEntity(TileEntityType<?> te_type)
{ super(te_type); reset(); } { super(te_type); reset(); }
public CompoundNBT reset_getnbt() public CompoundNBT reset_getnbt()
@ -350,7 +350,7 @@ public class BlockDecorFurnace
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BlockDecorFurnace.DecorFurnaceContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new FurnaceContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------ // IInventory ------------------------------------------------------------------------------
@ -436,17 +436,17 @@ public class BlockDecorFurnace
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(DecorFurnaceTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(FurnaceTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
{ {
switch(id) { switch(id) {
case 0: return DecorFurnaceTileEntity.this.burntime_left_; case 0: return FurnaceTileEntity.this.burntime_left_;
case 1: return DecorFurnaceTileEntity.this.fuel_burntime_; case 1: return FurnaceTileEntity.this.fuel_burntime_;
case 2: return (int)DecorFurnaceTileEntity.this.field_proc_time_elapsed_; case 2: return (int)FurnaceTileEntity.this.field_proc_time_elapsed_;
case 3: return DecorFurnaceTileEntity.this.proc_time_needed_; case 3: return FurnaceTileEntity.this.proc_time_needed_;
case 4: return DecorFurnaceTileEntity.this.field_is_burning_; case 4: return FurnaceTileEntity.this.field_is_burning_;
default: return 0; default: return 0;
} }
} }
@ -454,11 +454,11 @@ public class BlockDecorFurnace
public void set(int id, int value) public void set(int id, int value)
{ {
switch(id) { switch(id) {
case 0: DecorFurnaceTileEntity.this.burntime_left_ = value; break; case 0: FurnaceTileEntity.this.burntime_left_ = value; break;
case 1: DecorFurnaceTileEntity.this.fuel_burntime_ = value; break; case 1: FurnaceTileEntity.this.fuel_burntime_ = value; break;
case 2: DecorFurnaceTileEntity.this.field_proc_time_elapsed_ = value; break; case 2: FurnaceTileEntity.this.field_proc_time_elapsed_ = value; break;
case 3: DecorFurnaceTileEntity.this.proc_time_needed_ = value; break; case 3: FurnaceTileEntity.this.proc_time_needed_ = value; break;
case 4: DecorFurnaceTileEntity.this.field_is_burning_ = value; case 4: FurnaceTileEntity.this.field_is_burning_ = value;
} }
} }
}; };
@ -557,9 +557,9 @@ public class BlockDecorFurnace
if(transferItems(FIFO_FUEL_1_SLOT_NO, FIFO_FUEL_0_SLOT_NO, 1)) dirty = true; if(transferItems(FIFO_FUEL_1_SLOT_NO, FIFO_FUEL_0_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_INPUT_0_SLOT_NO, SMELTING_INPUT_SLOT_NO, 1)) dirty = true; if(transferItems(FIFO_INPUT_0_SLOT_NO, SMELTING_INPUT_SLOT_NO, 1)) dirty = true;
if(transferItems(FIFO_INPUT_1_SLOT_NO, FIFO_INPUT_0_SLOT_NO, 1)) dirty = true; if(transferItems(FIFO_INPUT_1_SLOT_NO, FIFO_INPUT_0_SLOT_NO, 1)) dirty = true;
heater_inserted_ = (ExtItems.IE_EXTERNAL_HEATER==null) // without IE always allow electrical boost heater_inserted_ = (ExternalObjects.IE_EXTERNAL_HEATER==null) // without IE always allow electrical boost
|| (stacks_.get(AUX_0_SLOT_NO).getItem()==ExtItems.IE_EXTERNAL_HEATER) || (stacks_.get(AUX_0_SLOT_NO).getItem()==ExternalObjects.IE_EXTERNAL_HEATER)
|| (stacks_.get(AUX_1_SLOT_NO).getItem()==ExtItems.IE_EXTERNAL_HEATER); || (stacks_.get(AUX_1_SLOT_NO).getItem()==ExternalObjects.IE_EXTERNAL_HEATER);
if(!burning()) cleanupRecentRecipes(); if(!burning()) cleanupRecentRecipes();
} }
ItemStack fuel = stacks_.get(SMELTING_FUEL_SLOT_NO); ItemStack fuel = stacks_.get(SMELTING_FUEL_SLOT_NO);
@ -600,8 +600,8 @@ public class BlockDecorFurnace
if(was_burning != burning()) { if(was_burning != burning()) {
dirty = true; dirty = true;
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof DecorFurnaceBlock) { if(state.getBlock() instanceof FurnaceBlock) {
world.setBlockState(pos, state.with(DecorFurnaceBlock.LIT, burning())); world.setBlockState(pos, state.with(FurnaceBlock.LIT, burning()));
} }
} }
if(dirty) { if(dirty) {
@ -750,10 +750,10 @@ public class BlockDecorFurnace
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container slots // Container slots
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorFurnaceContainer extends Container implements Networking.INetworkSynchronisableContainer public static class FurnaceContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
// Slots -------------------------------------------------------------------------------------------- // Slots --------------------------------------------------------------------------------------------
@ -804,8 +804,8 @@ public class BlockDecorFurnace
protected void onCrafting(ItemStack stack) protected void onCrafting(ItemStack stack)
{ {
stack.onCrafting(player_.world, player_, removeCount); stack.onCrafting(player_.world, player_, removeCount);
if((!player_.world.isRemote) && (inventory_ instanceof DecorFurnaceTileEntity)) { if((!player_.world.isRemote) && (inventory_ instanceof FurnaceTileEntity)) {
DecorFurnaceTileEntity te = (DecorFurnaceTileEntity)inventory_; FurnaceTileEntity te = (FurnaceTileEntity)inventory_;
int xp = removeCount; int xp = removeCount;
float sxp = te.getSmeltingExperience(stack); float sxp = te.getSmeltingExperience(stack);
if(sxp == 0) { if(sxp == 0) {
@ -826,14 +826,14 @@ public class BlockDecorFurnace
public static class BFuelSlot extends Slot public static class BFuelSlot extends Slot
{ {
private final DecorFurnaceContainer container_; private final FurnaceContainer container_;
public BFuelSlot(IInventory inventory, int index, int xpos, int ypos, DecorFurnaceContainer container) public BFuelSlot(IInventory inventory, int index, int xpos, int ypos, FurnaceContainer container)
{ super(inventory, index, xpos, ypos); container_=container; } { super(inventory, index, xpos, ypos); container_=container; }
@Override @Override
public boolean isItemValid(ItemStack stack) public boolean isItemValid(ItemStack stack)
{ return isBucket(stack) || (DecorFurnaceTileEntity.isFuel(container_.world(), stack)); } { return isBucket(stack) || (FurnaceTileEntity.isFuel(container_.world(), stack)); }
@Override @Override
public int getItemStackLimit(ItemStack stack) public int getItemStackLimit(ItemStack stack)
@ -857,17 +857,17 @@ public class BlockDecorFurnace
public IInventory inventory() { return inventory_ ; } public IInventory inventory() { return inventory_ ; }
public World world() { return player_.world; } public World world() { return player_.world; }
public DecorFurnaceContainer(int cid, PlayerInventory player_inventory) public FurnaceContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(DecorFurnaceTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(DecorFurnaceTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(FurnaceTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(FurnaceTileEntity.NUM_OF_FIELDS)); }
private DecorFurnaceContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private FurnaceContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_SMALL_LAB_FURNACE, cid); super(ModContent.CT_SMALL_LAB_FURNACE, cid);
player_ = player_inventory.player; player_ = player_inventory.player;
inventory_ = block_inventory; inventory_ = block_inventory;
wpc_ = wpc; wpc_ = wpc;
fields_ = fields; fields_ = fields;
recipe_type_ = DecorFurnaceTileEntity.RECIPE_TYPE; recipe_type_ = FurnaceTileEntity.RECIPE_TYPE;
addSlot(new Slot(inventory_, 0, 59, 17)); // smelting input addSlot(new Slot(inventory_, 0, 59, 17)); // smelting input
addSlot(new BFuelSlot(inventory_, 1, 59, 53, this)); // fuel addSlot(new BFuelSlot(inventory_, 1, 59, 53, this)); // fuel
addSlot(new BSlotResult(player_, inventory_, 2, 101, 35)); // smelting result addSlot(new BSlotResult(player_, inventory_, 2, 101, 35)); // smelting result
@ -915,13 +915,13 @@ public class BlockDecorFurnace
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player inventory // Player inventory
if(DecorFurnaceTileEntity.canSmelt(world(), slot_stack)) { if(FurnaceTileEntity.canSmelt(world(), slot_stack)) {
if( if(
(!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input (!mergeItemStack(slot_stack, 0, 1, false)) && // smelting input
(!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0 (!mergeItemStack(slot_stack, 3, 4, false)) && // fifo0
(!mergeItemStack(slot_stack, 4, 5, false)) // fifo1 (!mergeItemStack(slot_stack, 4, 5, false)) // fifo1
) return ItemStack.EMPTY; ) return ItemStack.EMPTY;
} else if(DecorFurnaceTileEntity.isFuel(player_.world, slot_stack)) { } else if(FurnaceTileEntity.isFuel(player_.world, slot_stack)) {
if( if(
(!mergeItemStack(slot_stack, 1, 2, false)) && // fuel input (!mergeItemStack(slot_stack, 1, 2, false)) && // fuel input
(!mergeItemStack(slot_stack, 5, 6, false)) && // fuel fifo0 (!mergeItemStack(slot_stack, 5, 6, false)) && // fuel fifo0
@ -978,11 +978,11 @@ public class BlockDecorFurnace
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class DecorFurnaceGui extends ContainerScreen<DecorFurnaceContainer> public static class FurnaceGui extends ContainerScreen<FurnaceContainer>
{ {
protected final PlayerEntity player_; protected final PlayerEntity player_;
public DecorFurnaceGui(DecorFurnaceContainer container, PlayerInventory player_inventory, ITextComponent title) public FurnaceGui(FurnaceContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -1017,7 +1017,7 @@ public class BlockDecorFurnace
{ final int tc=getContainer().field(2), T=getContainer().field(3); return ((T>0) && (tc>0)) ? (tc * pixels / T) : (0); } { final int tc=getContainer().field(2), T=getContainer().field(3); return ((T>0) && (tc>0)) ? (tc * pixels / T) : (0); }
private int flame_px(int pixels) private int flame_px(int pixels)
{ int ibt = getContainer().field(1); return ((getContainer().field(0) * pixels) / ((ibt>0) ? (ibt) : (DecorFurnaceTileEntity.STD_SMELTING_TIME))); } { int ibt = getContainer().field(1); return ((getContainer().field(0) * pixels) / ((ibt>0) ? (ibt) : (FurnaceTileEntity.STD_SMELTING_TIME))); }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorFull.java * @file EdGlassBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -25,9 +25,9 @@ import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class BlockDecorGlassBlock extends StainedGlassBlock implements IDecorBlock public class EdGlassBlock extends StainedGlassBlock implements IDecorBlock
{ {
public BlockDecorGlassBlock(long config, Block.Properties properties) public EdGlassBlock(long config, Block.Properties properties)
{ super(DyeColor.BLACK, properties); } { super(DyeColor.BLACK, properties); }
@Override @Override

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorHopper.java * @file EdHopper.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -18,10 +18,8 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.HopperBlock;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.HopperTileEntity;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
@ -58,7 +56,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.Supplier; import java.util.function.Supplier;
public class BlockDecorHopper public class EdHopper
{ {
public static void on_config(int cooldown_ticks) public static void on_config(int cooldown_ticks)
{ {
@ -69,9 +67,9 @@ public class BlockDecorHopper
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorHopperBlock extends BlockDecor.Directed implements IDecorBlock public static class HopperBlock extends DecorBlock.Directed implements IDecorBlock
{ {
public DecorHopperBlock(long config, Block.Properties builder, final Supplier<ArrayList<VoxelShape>> shape_supplier) public HopperBlock(long config, Block.Properties builder, final Supplier<ArrayList<VoxelShape>> shape_supplier)
{ super(config, builder, shape_supplier); } { super(config, builder, shape_supplier); }
@Override @Override
@ -95,7 +93,7 @@ public class BlockDecorHopper
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new DecorHopperTileEntity(); } { return new HopperTileEntity(); }
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
@ -105,10 +103,10 @@ public class BlockDecorHopper
CompoundNBT te_nbt = stack.getTag().getCompound("tedata"); CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return; if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return; if(!(te instanceof HopperTileEntity)) return;
((DecorHopperTileEntity)te).readnbt(te_nbt, false); ((HopperTileEntity)te).readnbt(te_nbt, false);
((DecorHopperTileEntity)te).reset_rtstate(); ((HopperTileEntity)te).reset_rtstate();
((DecorHopperTileEntity)te).markDirty(); ((HopperTileEntity)te).markDirty();
} }
@Override @Override
@ -121,10 +119,10 @@ public class BlockDecorHopper
final List<ItemStack> stacks = new ArrayList<ItemStack>(); final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return stacks; if(!(te instanceof HopperTileEntity)) return stacks;
if(!explosion) { if(!explosion) {
ItemStack stack = new ItemStack(this, 1); ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((DecorHopperTileEntity)te).clear_getnbt(); CompoundNBT te_nbt = ((HopperTileEntity)te).clear_getnbt();
if(!te_nbt.isEmpty()) { if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt); nbt.put("tedata", te_nbt);
@ -132,10 +130,10 @@ public class BlockDecorHopper
} }
stacks.add(stack); stacks.add(stack);
} else { } else {
for(ItemStack stack: ((DecorHopperTileEntity)te).stacks_) { for(ItemStack stack: ((HopperTileEntity)te).stacks_) {
if(!stack.isEmpty()) stacks.add(stack); if(!stack.isEmpty()) stacks.add(stack);
} }
((DecorHopperTileEntity)te).reset_rtstate(); ((HopperTileEntity)te).reset_rtstate();
} }
return stacks; return stacks;
} }
@ -145,7 +143,7 @@ public class BlockDecorHopper
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return ActionResultType.FAIL; if(!(te instanceof HopperTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
@ -157,8 +155,8 @@ public class BlockDecorHopper
{ {
if(!(world instanceof World) || (((World) world).isRemote)) return; if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return; if(!(te instanceof HopperTileEntity)) return;
((DecorHopperTileEntity)te).block_updated(); ((HopperTileEntity)te).block_updated();
} }
@Override @Override
@ -167,8 +165,8 @@ public class BlockDecorHopper
super.onFallenUpon(world, pos, entity, fallDistance); super.onFallenUpon(world, pos, entity, fallDistance);
if(!(entity instanceof ItemEntity)) return; if(!(entity instanceof ItemEntity)) return;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof DecorHopperTileEntity)) return; if(!(te instanceof HopperTileEntity)) return;
((DecorHopperTileEntity)te).collection_timer_ = 0; ((HopperTileEntity)te).collection_timer_ = 0;
} }
@Override @Override
@ -192,7 +190,7 @@ public class BlockDecorHopper
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorHopperTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory public static class HopperTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory
{ {
public static final int NUM_OF_FIELDS = 7; public static final int NUM_OF_FIELDS = 7;
public static final int TICK_INTERVAL = 10; public static final int TICK_INTERVAL = 10;
@ -217,14 +215,14 @@ public class BlockDecorHopper
private int tick_timer_ = 0; private int tick_timer_ = 0;
protected NonNullList<ItemStack> stacks_; protected NonNullList<ItemStack> stacks_;
public DecorHopperTileEntity() public HopperTileEntity()
{ {
this(ModContent.TET_FACTORY_HOPPER); this(ModContent.TET_FACTORY_HOPPER);
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
reset_rtstate(); reset_rtstate();
} }
public DecorHopperTileEntity(TileEntityType<?> te_type) public HopperTileEntity(TileEntityType<?> te_type)
{ {
super(te_type); super(te_type);
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
@ -325,7 +323,7 @@ public class BlockDecorHopper
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new DecorHopperContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new HopperContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory -------------------------------------------------------------------------------------------- // IInventory --------------------------------------------------------------------------------------------
@ -388,7 +386,7 @@ public class BlockDecorHopper
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(DecorHopperTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(HopperTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
@ -502,11 +500,11 @@ public class BlockDecorHopper
if(te == null) { delay_timer_ = TICK_INTERVAL+2; return false; } // no reason to recalculate this all the time if there is nothere to insert. if(te == null) { delay_timer_ = TICK_INTERVAL+2; return false; } // no reason to recalculate this all the time if there is nothere to insert.
final IItemHandler ih = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()).orElse(null); final IItemHandler ih = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()).orElse(null);
if(ih == null) { delay_timer_ = TICK_INTERVAL+2; return false; } if(ih == null) { delay_timer_ = TICK_INTERVAL+2; return false; }
if(te instanceof HopperTileEntity) { if(te instanceof net.minecraft.tileentity.HopperTileEntity) {
Direction f = world.getBlockState(pos.offset(facing)).get(HopperBlock.FACING); Direction f = world.getBlockState(pos.offset(facing)).get(net.minecraft.block.HopperBlock.FACING);
if(f==facing.getOpposite()) return false; // no back transfer if(f==facing.getOpposite()) return false; // no back transfer
} else if(te instanceof DecorHopperTileEntity) { } else if(te instanceof EdHopper.HopperTileEntity) {
Direction f = world.getBlockState(pos.offset(facing)).get(DecorHopperBlock.FACING); Direction f = world.getBlockState(pos.offset(facing)).get(EdHopper.HopperBlock.FACING);
if(f==facing.getOpposite()) return false; if(f==facing.getOpposite()) return false;
} }
ItemStack insert_stack = current_stack.copy(); ItemStack insert_stack = current_stack.copy();
@ -624,7 +622,7 @@ public class BlockDecorHopper
boolean trigger = (rssignal && ((block_power_updated_) || (!pulse_mode))); boolean trigger = (rssignal && ((block_power_updated_) || (!pulse_mode)));
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(state == null) { block_power_signal_= false; return; } if(state == null) { block_power_signal_= false; return; }
final Direction hopper_facing = state.get(DecorHopperBlock.FACING); final Direction hopper_facing = state.get(HopperBlock.FACING);
// Trigger edge detection for next cycle // Trigger edge detection for next cycle
{ {
boolean tr = world.isBlockPowered(pos); boolean tr = world.isBlockPowered(pos);
@ -661,17 +659,18 @@ public class BlockDecorHopper
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorHopperContainer extends Container implements Networking.INetworkSynchronisableContainer public static class HopperContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
private static final int PLAYER_INV_START_SLOTNO = DecorHopperTileEntity.NUM_OF_SLOTS; protected static final String QUICK_MOVE_ALL = "quick-move-all";
private static final int NUM_OF_CONTAINER_SLOTS = DecorHopperTileEntity.NUM_OF_SLOTS + 36; private static final int PLAYER_INV_START_SLOTNO = HopperTileEntity.NUM_OF_SLOTS;
private static final int NUM_OF_CONTAINER_SLOTS = HopperTileEntity.NUM_OF_SLOTS + 36;
protected static final int STORAGE_SLOT_BEGIN = 0; protected static final int STORAGE_SLOT_BEGIN = 0;
protected static final int STORAGE_SLOT_END = DecorHopperTileEntity.NUM_OF_SLOTS; protected static final int STORAGE_SLOT_END = HopperTileEntity.NUM_OF_SLOTS;
protected static final int PLAYER_SLOT_BEGIN = DecorHopperTileEntity.NUM_OF_SLOTS; protected static final int PLAYER_SLOT_BEGIN = HopperTileEntity.NUM_OF_SLOTS;
protected static final int PLAYER_SLOT_END = DecorHopperTileEntity.NUM_OF_SLOTS+36; protected static final int PLAYER_SLOT_END = HopperTileEntity.NUM_OF_SLOTS+36;
private final SlotRange player_inventory_slot_range; private final SlotRange player_inventory_slot_range;
private final SlotRange hopper_slot_range; private final SlotRange hopper_slot_range;
private final PlayerEntity player_; private final PlayerEntity player_;
@ -681,17 +680,17 @@ public class BlockDecorHopper
public final int field(int index) { return fields_.get(index); } public final int field(int index) { return fields_.get(index); }
public DecorHopperContainer(int cid, PlayerInventory player_inventory) public HopperContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(DecorHopperTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(DecorHopperTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(HopperTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(HopperTileEntity.NUM_OF_FIELDS)); }
private DecorHopperContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private HopperContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_FACTORY_HOPPER, cid); super(ModContent.CT_FACTORY_HOPPER, cid);
fields_ = fields; fields_ = fields;
wpc_ = wpc; wpc_ = wpc;
player_ = player_inventory.player; player_ = player_inventory.player;
inventory_ = block_inventory; inventory_ = block_inventory;
hopper_slot_range = new SlotRange(inventory_, 0, DecorHopperTileEntity.NUM_OF_SLOTS); hopper_slot_range = new SlotRange(inventory_, 0, HopperTileEntity.NUM_OF_SLOTS);
player_inventory_slot_range = new SlotRange(player_inventory, 0, 36); player_inventory_slot_range = new SlotRange(player_inventory, 0, 36);
int i=-1; int i=-1;
// input slots (stacks 0 to 17) // input slots (stacks 0 to 17)
@ -729,7 +728,7 @@ public class BlockDecorHopper
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player slot // Player slot
if(!mergeItemStack(slot_stack, 0, DecorHopperTileEntity.NUM_OF_SLOTS, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, 0, HopperTileEntity.NUM_OF_SLOTS, false)) return ItemStack.EMPTY;
} else { } else {
// invalid slot // invalid slot
return ItemStack.EMPTY; return ItemStack.EMPTY;
@ -772,18 +771,18 @@ public class BlockDecorHopper
@Override @Override
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
{ {
if(!(inventory_ instanceof DecorHopperTileEntity)) return; if(!(inventory_ instanceof HopperTileEntity)) return;
DecorHopperTileEntity te = (DecorHopperTileEntity)inventory_; HopperTileEntity te = (HopperTileEntity)inventory_;
if(nbt.contains("xsize")) te.transfer_count_ = MathHelper.clamp(nbt.getInt("xsize"), 1, DecorHopperTileEntity.MAX_TRANSFER_COUNT); if(nbt.contains("xsize")) te.transfer_count_ = MathHelper.clamp(nbt.getInt("xsize"), 1, HopperTileEntity.MAX_TRANSFER_COUNT);
if(nbt.contains("period")) te.transfer_period_ = MathHelper.clamp(nbt.getInt("period"), 0, 100); if(nbt.contains("period")) te.transfer_period_ = MathHelper.clamp(nbt.getInt("period"), 0, 100);
if(nbt.contains("range")) te.collection_range_ = MathHelper.clamp(nbt.getInt("range"), 0, DecorHopperTileEntity.MAX_COLLECTION_RANGE); if(nbt.contains("range")) te.collection_range_ = MathHelper.clamp(nbt.getInt("range"), 0, HopperTileEntity.MAX_COLLECTION_RANGE);
if(nbt.contains("logic")) te.logic_ = nbt.getInt("logic"); if(nbt.contains("logic")) te.logic_ = nbt.getInt("logic");
if(nbt.contains("manual_trigger") && (nbt.getInt("manual_trigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; } if(nbt.contains("manual_trigger") && (nbt.getInt("manual_trigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; }
if(nbt.contains("action")) { if(nbt.contains("action")) {
boolean changed = false; boolean changed = false;
final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1; final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1;
switch(nbt.getString("action")) { switch(nbt.getString("action")) {
case DecorHopperGui.QUICK_MOVE_ALL: { case QUICK_MOVE_ALL: {
if((slotId >= STORAGE_SLOT_BEGIN) && (slotId < STORAGE_SLOT_END) && (getSlot(slotId).getHasStack())) { if((slotId >= STORAGE_SLOT_BEGIN) && (slotId < STORAGE_SLOT_END) && (getSlot(slotId).getHasStack())) {
final Slot slot = getSlot(slotId); final Slot slot = getSlot(slotId);
ItemStack remaining = slot.getStack(); ItemStack remaining = slot.getStack();
@ -832,12 +831,11 @@ public class BlockDecorHopper
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class DecorHopperGui extends ContainerScreen<DecorHopperContainer> public static class HopperGui extends ContainerScreen<HopperContainer>
{ {
protected static final String QUICK_MOVE_ALL = "quick-move-all";
protected final PlayerEntity player_; protected final PlayerEntity player_;
public DecorHopperGui(DecorHopperContainer container, PlayerInventory player_inventory, ITextComponent title) public HopperGui(HopperContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -858,7 +856,7 @@ public class BlockDecorHopper
if((type == ClickType.QUICK_MOVE) && (slot!=null) && slot.getHasStack() && Auxiliaries.isShiftDown() && Auxiliaries.isCtrlDown()) { if((type == ClickType.QUICK_MOVE) && (slot!=null) && slot.getHasStack() && Auxiliaries.isShiftDown() && Auxiliaries.isCtrlDown()) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("slot", slotId); nbt.putInt("slot", slotId);
container.onGuiAction(QUICK_MOVE_ALL, nbt); container.onGuiAction(HopperContainer.QUICK_MOVE_ALL, nbt);
} else { } else {
super.handleMouseClick(slot, slotId, button, type); super.handleMouseClick(slot, slotId, button, type);
} }
@ -867,7 +865,7 @@ public class BlockDecorHopper
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
{ {
DecorHopperContainer container = (DecorHopperContainer)getContainer(); HopperContainer container = (HopperContainer)getContainer();
int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5); int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5);
if((!isPointInRegion(126, 1, 49, 60, mouseX, mouseY))) { if((!isPointInRegion(126, 1, 49, 60, mouseX, mouseY))) {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
@ -878,8 +876,8 @@ public class BlockDecorHopper
} else if(range >= 34) { } else if(range >= 34) {
range = container.field(0) + 1; // + range = container.field(0) + 1; // +
} else { } else {
range = (int)(0.5 + ((((double)DecorHopperTileEntity.MAX_COLLECTION_RANGE) * range)/34)); // slider range = (int)(0.5 + ((((double)HopperTileEntity.MAX_COLLECTION_RANGE) * range)/34)); // slider
range = MathHelper.clamp(range, 0, DecorHopperTileEntity.MAX_COLLECTION_RANGE); range = MathHelper.clamp(range, 0, HopperTileEntity.MAX_COLLECTION_RANGE);
} }
container.onGuiAction("range", range); container.onGuiAction("range", range);
} else if(isPointInRegion(128, 21, 44, 10, mouseX, mouseY)) { } else if(isPointInRegion(128, 21, 44, 10, mouseX, mouseY)) {
@ -900,15 +898,15 @@ public class BlockDecorHopper
} else if(ndrop >= 34) { } else if(ndrop >= 34) {
ndrop = container.field(1) + 1; // + ndrop = container.field(1) + 1; // +
} else { } else {
ndrop = MathHelper.clamp(1+ndrop, 1, DecorHopperTileEntity.MAX_TRANSFER_COUNT); // slider ndrop = MathHelper.clamp(1+ndrop, 1, HopperTileEntity.MAX_TRANSFER_COUNT); // slider
} }
container.onGuiAction("xsize", ndrop); container.onGuiAction("xsize", ndrop);
} else if(isPointInRegion(133, 49, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(133, 49, 9, 9, mouseX, mouseY)) {
container.onGuiAction("manual_trigger", 1); container.onGuiAction("manual_trigger", 1);
} else if(isPointInRegion(145, 49, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(145, 49, 9, 9, mouseX, mouseY)) {
container.onGuiAction("logic", container.field(2) ^ DecorHopperTileEntity.LOGIC_INVERTED); container.onGuiAction("logic", container.field(2) ^ HopperTileEntity.LOGIC_INVERTED);
} else if(isPointInRegion(159, 49, 7, 9, mouseX, mouseY)) { } else if(isPointInRegion(159, 49, 7, 9, mouseX, mouseY)) {
container.onGuiAction("logic", container.field(2) ^ DecorHopperTileEntity.LOGIC_CONTINUOUS); container.onGuiAction("logic", container.field(2) ^ HopperTileEntity.LOGIC_CONTINUOUS);
} }
return true; return true;
} }
@ -921,11 +919,11 @@ public class BlockDecorHopper
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_hopper_gui.png")); this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_hopper_gui.png"));
final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize(); final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize();
blit(x0, y0, 0, 0, w, h); blit(x0, y0, 0, 0, w, h);
DecorHopperContainer container = (DecorHopperContainer)getContainer(); HopperContainer container = (HopperContainer)getContainer();
// active slot // active slot
{ {
int slot_index = container.field(6); int slot_index = container.field(6);
if((slot_index < 0) || (slot_index >= DecorHopperTileEntity.NUM_OF_SLOTS)) slot_index = 0; if((slot_index < 0) || (slot_index >= HopperTileEntity.NUM_OF_SLOTS)) slot_index = 0;
int x = (x0+10+((slot_index % 6) * 18)); int x = (x0+10+((slot_index % 6) * 18));
int y = (y0+8+((slot_index / 6) * 17)); int y = (y0+8+((slot_index / 6) * 17));
blit(x, y, 200, 8, 18, 18); blit(x, y, 200, 8, 18, 18);
@ -933,7 +931,7 @@ public class BlockDecorHopper
// collection range // collection range
{ {
int lut[] = { 133, 141, 149, 157, 166 }; int lut[] = { 133, 141, 149, 157, 166 };
int px = lut[MathHelper.clamp(container.field(0), 0, DecorHopperTileEntity.MAX_COLLECTION_RANGE)]; int px = lut[MathHelper.clamp(container.field(0), 0, HopperTileEntity.MAX_COLLECTION_RANGE)];
int x = x0 + px - 2; int x = x0 + px - 2;
int y = y0 + 14; int y = y0 + 14;
blit(x, y, 179, 40, 5, 5); blit(x, y, 179, 40, 5, 5);
@ -959,14 +957,14 @@ public class BlockDecorHopper
} }
// trigger logic // trigger logic
{ {
int inverter_offset = ((container.field(2) & DecorHopperTileEntity.LOGIC_INVERTED) != 0) ? 11 : 0; int inverter_offset = ((container.field(2) & HopperTileEntity.LOGIC_INVERTED) != 0) ? 11 : 0;
blit(x0+145, y0+49, 177+inverter_offset, 49, 9, 9); blit(x0+145, y0+49, 177+inverter_offset, 49, 9, 9);
int pulse_mode_offset = ((container.field(2) & DecorHopperTileEntity.LOGIC_CONTINUOUS ) != 0) ? 9 : 0; int pulse_mode_offset = ((container.field(2) & HopperTileEntity.LOGIC_CONTINUOUS ) != 0) ? 9 : 0;
blit(x0+159, y0+49, 199+pulse_mode_offset, 49, 9, 9); blit(x0+159, y0+49, 199+pulse_mode_offset, 49, 9, 9);
} }
// delay timer running indicator // delay timer running indicator
{ {
if((container.field(4) > DecorHopperTileEntity.PERIOD_OFFSET) && ((System.currentTimeMillis() % 1000) < 500)) { if((container.field(4) > HopperTileEntity.PERIOD_OFFSET) && ((System.currentTimeMillis() % 1000) < 500)) {
blit(x0+148, y0+22, 187, 22, 3, 3); blit(x0+148, y0+22, 187, 22, 3, 3);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorHorizontalSupport.java * @file EdHorizontalSupportBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -32,7 +32,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
public class BlockDecorHorizontalSupport extends BlockDecor.WaterLoggable implements IDecorBlock public class EdHorizontalSupportBlock extends DecorBlock.WaterLoggable implements IDecorBlock
{ {
public static final BooleanProperty EASTWEST = BooleanProperty.create("eastwest"); public static final BooleanProperty EASTWEST = BooleanProperty.create("eastwest");
public static final BooleanProperty LEFTBEAM = BooleanProperty.create("leftbeam"); public static final BooleanProperty LEFTBEAM = BooleanProperty.create("leftbeam");
@ -40,9 +40,9 @@ public class BlockDecorHorizontalSupport extends BlockDecor.WaterLoggable implem
public static final IntegerProperty DOWNCONNECT = IntegerProperty.create("downconnect", 0, 2); public static final IntegerProperty DOWNCONNECT = IntegerProperty.create("downconnect", 0, 2);
protected final ArrayList<VoxelShape> AABBs; protected final ArrayList<VoxelShape> AABBs;
public BlockDecorHorizontalSupport(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdHorizontalSupportBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ {
super(config|BlockDecor.CFG_HORIZIONTAL, builder); super(config|DecorBlock.CFG_HORIZIONTAL, builder);
AABBs = new ArrayList<VoxelShape>(Arrays.asList( AABBs = new ArrayList<VoxelShape>(Arrays.asList(
// Effective bounding box // Effective bounding box
VoxelShapes.create(Auxiliaries.getRotatedAABB(unrotatedAABB.grow(2.0/16, 0, 0), Direction.NORTH, true)), VoxelShapes.create(Auxiliaries.getRotatedAABB(unrotatedAABB.grow(2.0/16, 0, 0), Direction.NORTH, true)),
@ -90,9 +90,9 @@ public class BlockDecorHorizontalSupport extends BlockDecor.WaterLoggable implem
final BlockState lstate = world.getBlockState((!ew) ? (pos.west()) : (pos.north()) ); final BlockState lstate = world.getBlockState((!ew) ? (pos.west()) : (pos.north()) );
final BlockState dstate = world.getBlockState(pos.down()); final BlockState dstate = world.getBlockState(pos.down());
int down_connector = 0; int down_connector = 0;
if((dstate.getBlock() instanceof BlockDecorStraightPole)) { if((dstate.getBlock() instanceof EdStraightPoleBlock)) {
final Direction dfacing = dstate.get(BlockDecorStraightPole.FACING); final Direction dfacing = dstate.get(EdStraightPoleBlock.FACING);
final BlockDecorStraightPole pole = (BlockDecorStraightPole)dstate.getBlock(); final EdStraightPoleBlock pole = (EdStraightPoleBlock)dstate.getBlock();
if((dfacing.getAxis() == Direction.Axis.Y)) { if((dfacing.getAxis() == Direction.Axis.Y)) {
if((pole== ModContent.THICK_STEEL_POLE) || ((pole==ModContent.THICK_STEEL_POLE_HEAD) && (dfacing==Direction.UP))) { if((pole== ModContent.THICK_STEEL_POLE) || ((pole==ModContent.THICK_STEEL_POLE_HEAD) && (dfacing==Direction.UP))) {
down_connector = 2; down_connector = 2;

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorLabeledCrate.java * @file EdLabeledCrate.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -62,7 +62,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
public class BlockDecorLabeledCrate public class EdLabeledCrate
{ {
private static boolean with_gui_mouse_handling = true; private static boolean with_gui_mouse_handling = true;
private static final HashSet<Item> unstorable_containers = new HashSet<Item>(); private static final HashSet<Item> unstorable_containers = new HashSet<Item>();
@ -520,6 +520,10 @@ public class BlockDecorLabeledCrate
public static class LabeledCrateContainer extends Container implements Networking.INetworkSynchronisableContainer public static class LabeledCrateContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
protected static final String QUICK_MOVE_ALL = "quick-move-all";
protected static final String INCREASE_STACK = "increase-stack";
protected static final String DECREASE_STACK = "decrease-stack";
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
protected static class StorageSlot extends Slot protected static class StorageSlot extends Slot
{ {
@ -649,7 +653,7 @@ public class BlockDecorLabeledCrate
if(!nbt.contains("action")) return; if(!nbt.contains("action")) return;
final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1; final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1;
switch(nbt.getString("action")) { switch(nbt.getString("action")) {
case LabeledCrateGui.QUICK_MOVE_ALL: { case QUICK_MOVE_ALL: {
if((slotId >= STORAGE_SLOT_BEGIN) && (slotId < STORAGE_SLOT_END) && (getSlot(slotId).getHasStack())) { if((slotId >= STORAGE_SLOT_BEGIN) && (slotId < STORAGE_SLOT_END) && (getSlot(slotId).getHasStack())) {
final Slot slot = getSlot(slotId); final Slot slot = getSlot(slotId);
ItemStack remaining = slot.getStack(); ItemStack remaining = slot.getStack();
@ -681,9 +685,9 @@ public class BlockDecorLabeledCrate
} }
changed = true; changed = true;
} break; } break;
case LabeledCrateGui.INCREASE_STACK: { case INCREASE_STACK: {
} break; } break;
case LabeledCrateGui.DECREASE_STACK: { case DECREASE_STACK: {
} break; } break;
} }
if(changed) { if(changed) {
@ -701,9 +705,6 @@ public class BlockDecorLabeledCrate
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class LabeledCrateGui extends ContainerScreen<LabeledCrateContainer> public static class LabeledCrateGui extends ContainerScreen<LabeledCrateContainer>
{ {
protected static final String QUICK_MOVE_ALL = "quick-move-all";
protected static final String INCREASE_STACK = "increase-stack";
protected static final String DECREASE_STACK = "decrease-stack";
protected final PlayerEntity player_; protected final PlayerEntity player_;
public LabeledCrateGui(LabeledCrateContainer container, PlayerInventory player_inventory, ITextComponent title) public LabeledCrateGui(LabeledCrateContainer container, PlayerInventory player_inventory, ITextComponent title)
@ -752,7 +753,7 @@ public class BlockDecorLabeledCrate
} else if((type == ClickType.QUICK_MOVE) && (slot!=null) && slot.getHasStack() && Auxiliaries.isShiftDown() && Auxiliaries.isCtrlDown()) { } else if((type == ClickType.QUICK_MOVE) && (slot!=null) && slot.getHasStack() && Auxiliaries.isShiftDown() && Auxiliaries.isCtrlDown()) {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("slot", slotId); nbt.putInt("slot", slotId);
action(QUICK_MOVE_ALL, nbt); action(LabeledCrateContainer.QUICK_MOVE_ALL, nbt);
} else { } else {
super.handleMouseClick(slot, slotId, button, type); super.handleMouseClick(slot, slotId, button, type);
} }
@ -772,7 +773,7 @@ public class BlockDecorLabeledCrate
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("slot", slot.slotNumber); nbt.putInt("slot", slot.slotNumber);
if(limit > 1) nbt.putInt("limit", limit); if(limit > 1) nbt.putInt("limit", limit);
action(INCREASE_STACK, nbt); action(LabeledCrateContainer.INCREASE_STACK, nbt);
} }
} }
} else if(wheel_inc < -0.1) { } else if(wheel_inc < -0.1) {
@ -780,7 +781,7 @@ public class BlockDecorLabeledCrate
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.putInt("slot", slot.slotNumber); nbt.putInt("slot", slot.slotNumber);
if(limit > 1) nbt.putInt("limit", limit); if(limit > 1) nbt.putInt("limit", limit);
action(DECREASE_STACK, nbt); action(LabeledCrateContainer.DECREASE_STACK, nbt);
} }
} }
return true; return true;

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorLadder.java * @file EdLadderBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -34,8 +34,7 @@ import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class EdLadderBlock extends LadderBlock implements IDecorBlock
public class BlockDecorLadder extends LadderBlock implements IDecorBlock
{ {
protected static final AxisAlignedBB EDLADDER_UNROTATED_AABB = Auxiliaries.getPixeledAABB(3, 0, 0, 13, 16, 3); protected static final AxisAlignedBB EDLADDER_UNROTATED_AABB = Auxiliaries.getPixeledAABB(3, 0, 0, 13, 16, 3);
protected static final VoxelShape EDLADDER_SOUTH_AABB = VoxelShapes.create(Auxiliaries.getRotatedAABB(EDLADDER_UNROTATED_AABB, Direction.SOUTH, false)); protected static final VoxelShape EDLADDER_SOUTH_AABB = VoxelShapes.create(Auxiliaries.getRotatedAABB(EDLADDER_UNROTATED_AABB, Direction.SOUTH, false));
@ -47,7 +46,7 @@ public class BlockDecorLadder extends LadderBlock implements IDecorBlock
public static void on_config(boolean without_speed_boost) public static void on_config(boolean without_speed_boost)
{ without_speed_boost_ = without_speed_boost; } { without_speed_boost_ = without_speed_boost; }
public BlockDecorLadder(long config, Block.Properties builder) public EdLadderBlock(long config, Block.Properties builder)
{ super(builder); } { super(builder); }
@Override @Override
@ -91,7 +90,7 @@ public class BlockDecorLadder extends LadderBlock implements IDecorBlock
if(Math.abs(lvy) < 0.94) return; if(Math.abs(lvy) < 0.94) return;
final BlockPos pos = player.getPosition(); final BlockPos pos = player.getPosition();
final BlockState state = player.world.getBlockState(pos); final BlockState state = player.world.getBlockState(pos);
if(!(state.getBlock() instanceof BlockDecorLadder)) return; if(!(state.getBlock() instanceof EdLadderBlock)) return;
player.fallDistance = 0; player.fallDistance = 0;
player.setMotionMultiplier(state, new Vec3d(0.2, (lvy>0)?(3):(6), 0.2)); player.setMotionMultiplier(state, new Vec3d(0.2, (lvy>0)?(3):(6), 0.2));
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorMilker.java * @file EdMilker.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -11,7 +11,7 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.libmc.detail.Inventories;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.detail.ExtItems; import wile.engineersdecor.detail.ExternalObjects;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
@ -53,86 +53,93 @@ import java.util.Map.Entry;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class BlockDecorMilker extends BlockDecor.Horizontal implements IDecorBlock public class EdMilker
{ {
public static final BooleanProperty FILLED = BooleanProperty.create("filled"); //--------------------------------------------------------------------------------------------------------------------
public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); // Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorMilker(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) public static class MilkerBlock extends DecorBlock.Horizontal implements IDecorBlock
{ super(config, builder, unrotatedAABBs); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(ACTIVE); builder.add(FILLED); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(FILLED, false).with(ACTIVE, false); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos)
{ {
BTileEntity te = getTe(world, pos); public static final BooleanProperty FILLED = BooleanProperty.create("filled");
return (te==null) ? 0 : MathHelper.clamp((16 * te.fluid_level())/BTileEntity.TANK_CAPACITY, 0, 15); public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
}
@Override public MilkerBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs)
public boolean hasTileEntity(BlockState state) { super(config, builder, unrotatedAABBs); }
{ return true; }
@Override @Override
@Nullable protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
public TileEntity createTileEntity(BlockState state, IBlockReader world) { super.fillStateContainer(builder); builder.add(ACTIVE); builder.add(FILLED); }
{ return new BTileEntity(); }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) @Nullable
{ public BlockState getStateForPlacement(BlockItemUseContext context)
if(world.isRemote) return ActionResultType.SUCCESS; { return super.getStateForPlacement(context).with(FILLED, false).with(ACTIVE, false); }
BTileEntity te = getTe(world, pos);
if(te==null) return ActionResultType.FAIL; @Override
final ItemStack in_stack = player.getHeldItem(hand); @SuppressWarnings("deprecation")
final ItemStack out_stack = BTileEntity.milk_filled_container_item(in_stack); public boolean hasComparatorInputOverride(BlockState state)
if(out_stack.isEmpty() && (te.fluid_handler()!=null)) return FluidUtil.interactWithFluidHandler(player, hand, te.fluid_handler()) ? ActionResultType.SUCCESS : ActionResultType.FAIL; { return true; }
boolean drained = false;
IItemHandler player_inventory = new PlayerMainInvWrapper(player.inventory); @Override
if(te.fluid_level() >= BTileEntity.BUCKET_SIZE) { @SuppressWarnings("deprecation")
final ItemStack insert_stack = out_stack.copy(); public int getComparatorInputOverride(BlockState state, World world, BlockPos pos)
ItemStack remainder = ItemHandlerHelper.insertItemStacked(player_inventory, insert_stack, false); {
if(remainder.getCount() < insert_stack.getCount()) { MilkerTileEntity te = getTe(world, pos);
te.drain(BTileEntity.BUCKET_SIZE); return (te==null) ? 0 : MathHelper.clamp((16 * te.fluid_level())/MilkerTileEntity.TANK_CAPACITY, 0, 15);
in_stack.shrink(1); }
drained = true;
if(remainder.getCount() > 0) { @Override
final ItemEntity ei = new ItemEntity(world, player.getPosition().getX(), player.getPosition().getY()+0.5, player.getPosition().getZ(), remainder); public boolean hasTileEntity(BlockState state)
ei.setPickupDelay(40); { return true; }
ei.setMotion(0,0,0);
world.addEntity(ei); @Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new MilkerTileEntity(); }
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
if(world.isRemote) return ActionResultType.SUCCESS;
MilkerTileEntity te = getTe(world, pos);
if(te==null) return ActionResultType.FAIL;
final ItemStack in_stack = player.getHeldItem(hand);
final ItemStack out_stack = MilkerTileEntity.milk_filled_container_item(in_stack);
if(out_stack.isEmpty() && (te.fluid_handler()!=null)) return FluidUtil.interactWithFluidHandler(player, hand, te.fluid_handler()) ? ActionResultType.SUCCESS : ActionResultType.FAIL;
boolean drained = false;
IItemHandler player_inventory = new PlayerMainInvWrapper(player.inventory);
if(te.fluid_level() >= MilkerTileEntity.BUCKET_SIZE) {
final ItemStack insert_stack = out_stack.copy();
ItemStack remainder = ItemHandlerHelper.insertItemStacked(player_inventory, insert_stack, false);
if(remainder.getCount() < insert_stack.getCount()) {
te.drain(MilkerTileEntity.BUCKET_SIZE);
in_stack.shrink(1);
drained = true;
if(remainder.getCount() > 0) {
final ItemEntity ei = new ItemEntity(world, player.getPosition().getX(), player.getPosition().getY()+0.5, player.getPosition().getZ(), remainder);
ei.setPickupDelay(40);
ei.setMotion(0,0,0);
world.addEntity(ei);
}
} }
} }
if(drained) {
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 0.8f, 1f);
}
return ActionResultType.SUCCESS;
} }
if(drained) {
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 0.8f, 1f);
}
return ActionResultType.SUCCESS;
}
@Nullable @Nullable
private BTileEntity getTe(World world, BlockPos pos) private MilkerTileEntity getTe(World world, BlockPos pos)
{ final TileEntity te=world.getTileEntity(pos); return (!(te instanceof BTileEntity)) ? (null) : ((BTileEntity)te); } { final TileEntity te=world.getTileEntity(pos); return (!(te instanceof MilkerTileEntity)) ? (null) : ((MilkerTileEntity)te); }
}
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage, IFluidTank, ICapabilityProvider public static class MilkerTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage, IFluidTank, ICapabilityProvider
{ {
public static final int BUCKET_SIZE = 1000; public static final int BUCKET_SIZE = 1000;
public static final int TICK_INTERVAL = 80; public static final int TICK_INTERVAL = 80;
@ -171,19 +178,19 @@ public class BlockDecorMilker extends BlockDecor.Horizontal implements IDecorBlo
} }
{ {
milk_containers_.put(new ItemStack(Items.BUCKET), new ItemStack(Items.MILK_BUCKET)); milk_containers_.put(new ItemStack(Items.BUCKET), new ItemStack(Items.MILK_BUCKET));
if(ExtItems.BOTTLED_MILK_BOTTLE_DRINKLABLE!=null) milk_containers_.put(new ItemStack(Items.GLASS_BOTTLE), new ItemStack(ExtItems.BOTTLED_MILK_BOTTLE_DRINKLABLE)); if(ExternalObjects.BOTTLED_MILK_BOTTLE_DRINKLABLE!=null) milk_containers_.put(new ItemStack(Items.GLASS_BOTTLE), new ItemStack(ExternalObjects.BOTTLED_MILK_BOTTLE_DRINKLABLE));
} }
ModEngineersDecor.logger().info( ModEngineersDecor.logger().info(
"Config milker energy consumption:" + energy_consumption + "rf/t" "Config milker energy consumption:" + energy_consumption + "rf/t"
+ ((milk_fluid_==null)?"":" [milk fluid available]") + ((milk_fluid_==null)?"":" [milk fluid available]")
+ ((ExtItems.BOTTLED_MILK_BOTTLE_DRINKLABLE==null)?"":" [bottledmilk mod available]") + ((ExternalObjects.BOTTLED_MILK_BOTTLE_DRINKLABLE==null)?"":" [bottledmilk mod available]")
); );
} }
public BTileEntity() public MilkerTileEntity()
{ this(ModContent.TET_SMALL_MILKING_MACHINE); } { this(ModContent.TET_SMALL_MILKING_MACHINE); }
public BTileEntity(TileEntityType<?> te_type) public MilkerTileEntity(TileEntityType<?> te_type)
{ super(te_type); reset(); } { super(te_type); reset(); }
public void reset() public void reset()
@ -271,8 +278,8 @@ public class BlockDecorMilker extends BlockDecor.Horizontal implements IDecorBlo
private static class BFluidHandler implements IFluidHandler private static class BFluidHandler implements IFluidHandler
{ {
private final BTileEntity te; private final MilkerTileEntity te;
BFluidHandler(BTileEntity te) { this.te = te; } BFluidHandler(MilkerTileEntity te) { this.te = te; }
@Override public int getTanks() { return 1; } @Override public int getTanks() { return 1; }
@Override public FluidStack getFluidInTank(int tank) { return te.getFluid(); } @Override public FluidStack getFluidInTank(int tank) { return te.getFluid(); }
@Override public int getTankCapacity(int tank) { return te.getCapacity(); } @Override public int getTankCapacity(int tank) { return te.getCapacity(); }
@ -383,7 +390,7 @@ public class BlockDecorMilker extends BlockDecor.Horizontal implements IDecorBlo
private boolean milking_process() private boolean milking_process()
{ {
if((tracked_cow_ == null) && (fluid_level() >= MAX_MILKING_TANK_LEVEL)) return false; // nothing to do if((tracked_cow_ == null) && (fluid_level() >= MAX_MILKING_TANK_LEVEL)) return false; // nothing to do
final Direction facing = world.getBlockState(getPos()).get(HORIZONTAL_FACING).getOpposite(); final Direction facing = world.getBlockState(getPos()).get(MilkerBlock.HORIZONTAL_FACING).getOpposite();
final Vec3d target_pos = new Vec3d(getPos().offset(facing)).add(0.5,0,0.5); final Vec3d target_pos = new Vec3d(getPos().offset(facing)).add(0.5,0,0.5);
CowEntity cow = null; CowEntity cow = null;
{ {
@ -547,11 +554,11 @@ public class BlockDecorMilker extends BlockDecor.Horizontal implements IDecorBlo
// Adjacent inventory update, only done just after milking to prevent waste of server cpu. // Adjacent inventory update, only done just after milking to prevent waste of server cpu.
if(dirty && (fluid_level() >= BUCKET_SIZE)) { if(dirty && (fluid_level() >= BUCKET_SIZE)) {
log("Try item transfer"); log("Try item transfer");
fill_adjacent_inventory_item_containers(block_state.get(HORIZONTAL_FACING)); fill_adjacent_inventory_item_containers(block_state.get(MilkerBlock.HORIZONTAL_FACING));
} }
} }
// State update // State update
BlockState new_state = block_state.with(FILLED, fluid_level()>=FILLED_INDICATION_THRESHOLD).with(ACTIVE, state_==MilkingState.MILKING); BlockState new_state = block_state.with(MilkerBlock.FILLED, fluid_level()>=FILLED_INDICATION_THRESHOLD).with(MilkerBlock.ACTIVE, state_==MilkingState.MILKING);
if(block_state != new_state) world.setBlockState(pos, new_state,1|2|16); if(block_state != new_state) world.setBlockState(pos, new_state,1|2|16);
if(dirty) markDirty(); if(dirty) markDirty();
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorMineralSmelter.java * @file EdMineralSmelter.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -52,18 +52,18 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.*; import java.util.*;
public class BlockDecorMineralSmelter public class EdMineralSmelter
{ {
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorMineralSmelterBlock extends BlockDecor.Horizontal implements IDecorBlock public static class MineralSmelterBlock extends DecorBlock.Horizontal implements IDecorBlock
{ {
public static final int PHASE_MAX = 3; public static final int PHASE_MAX = 3;
public static final IntegerProperty PHASE = IntegerProperty.create("phase", 0, PHASE_MAX); public static final IntegerProperty PHASE = IntegerProperty.create("phase", 0, PHASE_MAX);
public DecorMineralSmelterBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public MineralSmelterBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override
@ -92,7 +92,7 @@ public class BlockDecorMineralSmelter
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorMineralSmelter.DecorMineralSmelterTileEntity(); } { return new EdMineralSmelter.MineralSmelterTileEntity(); }
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
@ -107,7 +107,7 @@ public class BlockDecorMineralSmelter
{ {
final List<ItemStack> stacks = new ArrayList<ItemStack>(); final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; if(world.isRemote) return stacks;
final DecorMineralSmelterTileEntity te = getTe(world, pos); final MineralSmelterTileEntity te = getTe(world, pos);
if(te == null) return stacks; if(te == null) return stacks;
te.reset_process(); te.reset_process();
stacks.add(new ItemStack(this, 1)); stacks.add(new ItemStack(this, 1));
@ -119,13 +119,13 @@ public class BlockDecorMineralSmelter
{ {
if(player.isShiftKeyDown()) return ActionResultType.PASS; if(player.isShiftKeyDown()) return ActionResultType.PASS;
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote) return ActionResultType.SUCCESS;
DecorMineralSmelterTileEntity te = getTe(world, pos); MineralSmelterTileEntity te = getTe(world, pos);
if(te==null) return ActionResultType.FAIL; if(te==null) return ActionResultType.FAIL;
final ItemStack stack = player.getHeldItem(hand); final ItemStack stack = player.getHeldItem(hand);
boolean dirty = false; boolean dirty = false;
if(te.accepts_lava_container(stack)) { if(te.accepts_lava_container(stack)) {
if(stack.isItemEqualIgnoreDurability(DecorMineralSmelterTileEntity.BUCKET_STACK)) { // check how this works with item capabilities or so if(stack.isItemEqualIgnoreDurability(MineralSmelterTileEntity.BUCKET_STACK)) { // check how this works with item capabilities or so
if(te.fluid_level() >= DecorMineralSmelterTileEntity.MAX_BUCKET_EXTRACT_FLUID_LEVEL) { if(te.fluid_level() >= MineralSmelterTileEntity.MAX_BUCKET_EXTRACT_FLUID_LEVEL) {
if(stack.getCount() > 1) { if(stack.getCount() > 1) {
int target_stack_index = -1; int target_stack_index = -1;
for(int i=0; i<player.inventory.getSizeInventory(); ++i) { for(int i=0; i<player.inventory.getSizeInventory(); ++i) {
@ -138,13 +138,13 @@ public class BlockDecorMineralSmelter
te.reset_process(); te.reset_process();
stack.shrink(1); stack.shrink(1);
player.setHeldItem(hand, stack); player.setHeldItem(hand, stack);
player.inventory.setInventorySlotContents(target_stack_index, DecorMineralSmelterTileEntity.LAVA_BUCKET_STACK.copy()); player.inventory.setInventorySlotContents(target_stack_index, MineralSmelterTileEntity.LAVA_BUCKET_STACK.copy());
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1f, 1f); world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1f, 1f);
dirty = true; dirty = true;
} }
} else { } else {
te.reset_process(); te.reset_process();
player.setHeldItem(hand, DecorMineralSmelterTileEntity.LAVA_BUCKET_STACK.copy()); player.setHeldItem(hand, MineralSmelterTileEntity.LAVA_BUCKET_STACK.copy());
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1f, 1f); world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1f, 1f);
dirty = true; dirty = true;
} }
@ -152,7 +152,7 @@ public class BlockDecorMineralSmelter
} }
} else if(stack.isEmpty()) { } else if(stack.isEmpty()) {
final ItemStack istack = te.getStackInSlot(1).copy(); final ItemStack istack = te.getStackInSlot(1).copy();
if(te.phase() > DecorMineralSmelterTileEntity.PHASE_WARMUP) player.setFire(1); if(te.phase() > MineralSmelterTileEntity.PHASE_WARMUP) player.setFire(1);
if(!istack.isEmpty()) { if(!istack.isEmpty()) {
istack.setCount(1); istack.setCount(1);
player.setHeldItem(hand, istack); player.setHeldItem(hand, istack);
@ -174,16 +174,16 @@ public class BlockDecorMineralSmelter
if(state.getBlock()!=this) return; if(state.getBlock()!=this) return;
IParticleData particle = ParticleTypes.SMOKE; IParticleData particle = ParticleTypes.SMOKE;
switch(state.get(PHASE)) { switch(state.get(PHASE)) {
case DecorMineralSmelterTileEntity.PHASE_WARMUP: case MineralSmelterTileEntity.PHASE_WARMUP:
return; return;
case DecorMineralSmelterTileEntity.PHASE_HOT: case MineralSmelterTileEntity.PHASE_HOT:
if(rnd.nextInt(10) > 4) return; if(rnd.nextInt(10) > 4) return;
break; break;
case DecorMineralSmelterTileEntity.PHASE_MAGMABLOCK: case MineralSmelterTileEntity.PHASE_MAGMABLOCK:
if(rnd.nextInt(10) > 7) return; if(rnd.nextInt(10) > 7) return;
particle = ParticleTypes.LARGE_SMOKE; particle = ParticleTypes.LARGE_SMOKE;
break; break;
case DecorMineralSmelterTileEntity.PHASE_LAVA: case MineralSmelterTileEntity.PHASE_LAVA:
if(rnd.nextInt(10) > 2) return; if(rnd.nextInt(10) > 2) return;
particle = ParticleTypes.LAVA; particle = ParticleTypes.LAVA;
break; break;
@ -196,15 +196,15 @@ public class BlockDecorMineralSmelter
} }
@Nullable @Nullable
private DecorMineralSmelterTileEntity getTe(World world, BlockPos pos) private MineralSmelterTileEntity getTe(World world, BlockPos pos)
{ final TileEntity te=world.getTileEntity(pos); return (!(te instanceof DecorMineralSmelterTileEntity)) ? (null) : ((DecorMineralSmelterTileEntity)te); } { final TileEntity te=world.getTileEntity(pos); return (!(te instanceof MineralSmelterTileEntity)) ? (null) : ((MineralSmelterTileEntity)te); }
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorMineralSmelterTileEntity extends TileEntity implements INameable, ITickableTileEntity, ISidedInventory, IEnergyStorage, ICapabilityProvider public static class MineralSmelterTileEntity extends TileEntity implements INameable, ITickableTileEntity, ISidedInventory, IEnergyStorage, ICapabilityProvider
{ {
public static final int TICK_INTERVAL = 20; public static final int TICK_INTERVAL = 20;
public static final int MAX_FLUID_LEVEL = 1000; public static final int MAX_FLUID_LEVEL = 1000;
@ -246,10 +246,10 @@ public class BlockDecorMineralSmelter
ModEngineersDecor.logger().info("Config mineal smelter energy consumption:" + energy_consumption + "rf/t, heat-up rate: " + heatup_rate + "%/s."); ModEngineersDecor.logger().info("Config mineal smelter energy consumption:" + energy_consumption + "rf/t, heat-up rate: " + heatup_rate + "%/s.");
} }
public DecorMineralSmelterTileEntity() public MineralSmelterTileEntity()
{ this(ModContent.TET_MINERAL_SMELTER); } { this(ModContent.TET_MINERAL_SMELTER); }
public DecorMineralSmelterTileEntity(TileEntityType<?> te_type) public MineralSmelterTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public int progress() public int progress()
@ -439,9 +439,9 @@ public class BlockDecorMineralSmelter
protected static class BItemHandler implements IItemHandler protected static class BItemHandler implements IItemHandler
{ {
private DecorMineralSmelterTileEntity te; private MineralSmelterTileEntity te;
BItemHandler(DecorMineralSmelterTileEntity te) BItemHandler(MineralSmelterTileEntity te)
{ this.te = te; } { this.te = te; }
@Override @Override
@ -484,9 +484,9 @@ public class BlockDecorMineralSmelter
private static class BFluidHandler implements IFluidHandler private static class BFluidHandler implements IFluidHandler
{ {
private final FluidStack lava; private final FluidStack lava;
private final DecorMineralSmelterTileEntity te; private final MineralSmelterTileEntity te;
BFluidHandler(DecorMineralSmelterTileEntity te) BFluidHandler(MineralSmelterTileEntity te)
{ this.te = te; lava = new net.minecraftforge.fluids.FluidStack(net.minecraft.fluid.Fluids.LAVA, 1); } { this.te = te; lava = new net.minecraftforge.fluids.FluidStack(net.minecraft.fluid.Fluids.LAVA, 1); }
@Override public int getTanks() { return 1; } @Override public int getTanks() { return 1; }
@ -651,8 +651,8 @@ public class BlockDecorMineralSmelter
} }
// Block state // Block state
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if((state.getBlock() instanceof DecorMineralSmelterBlock) && (force_block_update_ || (state.get(DecorMineralSmelterBlock.PHASE) != new_phase))) { if((state.getBlock() instanceof MineralSmelterBlock) && (force_block_update_ || (state.get(MineralSmelterBlock.PHASE) != new_phase))) {
state = state.with(DecorMineralSmelterBlock.PHASE, new_phase); state = state.with(MineralSmelterBlock.PHASE, new_phase);
world.setBlockState(pos, state,3|16); world.setBlockState(pos, state,3|16);
world.notifyNeighborsOfStateChange(getPos(), state.getBlock()); world.notifyNeighborsOfStateChange(getPos(), state.getBlock());
force_block_update_ = false; force_block_update_ = false;
@ -660,5 +660,4 @@ public class BlockDecorMineralSmelter
if(dirty) markDirty(); if(dirty) markDirty();
} }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorPipeValve.java * @file EdPipeValve.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -39,7 +39,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorPipeValve public class EdPipeValve
{ {
public static final int CFG_CHECK_VALVE = 0x1; public static final int CFG_CHECK_VALVE = 0x1;
public static final int CFG_ANALOG_VALVE = 0x2; public static final int CFG_ANALOG_VALVE = 0x2;
@ -47,16 +47,16 @@ public class BlockDecorPipeValve
public static void on_config(int container_size_decl, int redstone_slope) public static void on_config(int container_size_decl, int redstone_slope)
{ {
DecorPipeValveTileEntity.fluid_maxflow_mb = MathHelper.clamp(container_size_decl, 1, 10000); PipeValveTileEntity.fluid_maxflow_mb = MathHelper.clamp(container_size_decl, 1, 10000);
DecorPipeValveTileEntity.redstone_flow_slope_mb = MathHelper.clamp(redstone_slope, 1, 10000); PipeValveTileEntity.redstone_flow_slope_mb = MathHelper.clamp(redstone_slope, 1, 10000);
ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + DecorPipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + DecorPipeValveTileEntity.redstone_flow_slope_mb + "mb/sig"); ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + PipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + PipeValveTileEntity.redstone_flow_slope_mb + "mb/sig");
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Block // Block
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorPipeValveBlock extends BlockDecor.DirectedWaterLoggable implements IDecorBlock public static class PipeValveBlock extends DecorBlock.DirectedWaterLoggable implements IDecorBlock
{ {
public static final BooleanProperty RS_CN_N = BooleanProperty.create("rs_n"); public static final BooleanProperty RS_CN_N = BooleanProperty.create("rs_n");
public static final BooleanProperty RS_CN_S = BooleanProperty.create("rs_s"); public static final BooleanProperty RS_CN_S = BooleanProperty.create("rs_s");
@ -69,12 +69,12 @@ public class BlockDecorPipeValve
public static void on_config(int container_size_decl, int redstone_slope) public static void on_config(int container_size_decl, int redstone_slope)
{ {
DecorPipeValveTileEntity.fluid_maxflow_mb = MathHelper.clamp(container_size_decl, 1, 10000); PipeValveTileEntity.fluid_maxflow_mb = MathHelper.clamp(container_size_decl, 1, 10000);
DecorPipeValveTileEntity.redstone_flow_slope_mb = MathHelper.clamp(redstone_slope, 1, 10000); PipeValveTileEntity.redstone_flow_slope_mb = MathHelper.clamp(redstone_slope, 1, 10000);
ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + DecorPipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + DecorPipeValveTileEntity.redstone_flow_slope_mb + "mb/sig"); ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + PipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + PipeValveTileEntity.redstone_flow_slope_mb + "mb/sig");
} }
public DecorPipeValveBlock(long config, int valve_config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) public PipeValveBlock(long config, int valve_config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
{ super(config, builder, unrotatedAABB); this.valve_config = valve_config; } { super(config, builder, unrotatedAABB); this.valve_config = valve_config; }
private BlockState get_rsconnector_state(BlockState state, IWorld world, BlockPos pos, @Nullable BlockPos fromPos) private BlockState get_rsconnector_state(BlockState state, IWorld world, BlockPos pos, @Nullable BlockPos fromPos)
@ -134,7 +134,7 @@ public class BlockDecorPipeValve
@Override @Override
@Nullable @Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world) public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new DecorPipeValveTileEntity(); } { return new PipeValveTileEntity(); }
@Override @Override
public BlockState rotate(BlockState state, IWorld world, BlockPos pos, Rotation direction) public BlockState rotate(BlockState state, IWorld world, BlockPos pos, Rotation direction)
@ -164,7 +164,7 @@ public class BlockDecorPipeValve
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class DecorPipeValveTileEntity extends TileEntity implements ICapabilityProvider //, IFluidPipe public static class PipeValveTileEntity extends TileEntity implements ICapabilityProvider //, IFluidPipe
{ {
protected static int fluid_maxflow_mb = 1000; protected static int fluid_maxflow_mb = 1000;
protected static int redstone_flow_slope_mb = 1000/15; protected static int redstone_flow_slope_mb = 1000/15;
@ -172,23 +172,23 @@ public class BlockDecorPipeValve
private boolean filling_ = false; private boolean filling_ = false;
private int valve_config_; private int valve_config_;
public DecorPipeValveTileEntity() public PipeValveTileEntity()
{ this(ModContent.TET_STRAIGHT_PIPE_VALVE); } { this(ModContent.TET_STRAIGHT_PIPE_VALVE); }
public DecorPipeValveTileEntity(TileEntityType<?> te_type) public PipeValveTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
private Direction block_facing() private Direction block_facing()
{ {
BlockState st = getWorld().getBlockState(getPos()); BlockState st = getWorld().getBlockState(getPos());
return (st.getBlock() instanceof DecorPipeValveBlock) ? st.get(DecorPipeValveBlock.FACING) : Direction.NORTH; return (st.getBlock() instanceof PipeValveBlock) ? st.get(PipeValveBlock.FACING) : Direction.NORTH;
} }
private long valve_config() private long valve_config()
{ {
if(valve_config_ <= 0) { if(valve_config_ <= 0) {
final Block block = getWorld().getBlockState(getPos()).getBlock(); final Block block = getWorld().getBlockState(getPos()).getBlock();
if(block instanceof DecorPipeValveBlock) valve_config_ = ((DecorPipeValveBlock)block).valve_config; if(block instanceof PipeValveBlock) valve_config_ = ((PipeValveBlock)block).valve_config;
} }
return valve_config_; return valve_config_;
} }
@ -234,8 +234,8 @@ public class BlockDecorPipeValve
private static class MainFlowHandler implements IFluidHandler private static class MainFlowHandler implements IFluidHandler
{ {
private DecorPipeValveTileEntity te; private PipeValveTileEntity te;
public MainFlowHandler(DecorPipeValveTileEntity te) { this.te = te; } public MainFlowHandler(PipeValveTileEntity te) { this.te = te; }
@Override public int getTanks() { return 0; } @Override public int getTanks() { return 0; }
@Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; } @Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; }
@Override public int getTankCapacity(int tank) { return fluid_maxflow_mb; } @Override public int getTankCapacity(int tank) { return fluid_maxflow_mb; }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorPlacer.java * @file EdPlacer.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -54,118 +54,125 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock public class EdPlacer
{ {
public BlockDecorPlacer(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) //--------------------------------------------------------------------------------------------------------------------
{ super(config, builder, unrotatedAABB); } // Block
//--------------------------------------------------------------------------------------------------------------------
@Override public static class PlacerBlock extends DecorBlock.Directed implements IDecorBlock
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
{ return VoxelShapes.fullCube(); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{ {
if(world.isRemote) return; public PlacerBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return; { super(config, builder, unrotatedAABB); }
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).readnbt(te_nbt, false);
((BTileEntity)te).reset_rtstate();
((BTileEntity)te).markDirty();
}
@Override @Override
public boolean hasDynamicDropList() public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
{ return true; } { return VoxelShapes.fullCube(); }
@Override @Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) @SuppressWarnings("deprecation")
{ public boolean hasComparatorInputOverride(BlockState state)
final List<ItemStack> stacks = new ArrayList<ItemStack>(); { return true; }
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos); @Override
if(!(te instanceof BTileEntity)) return stacks; @SuppressWarnings("deprecation")
if(!explosion) { public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
ItemStack stack = new ItemStack(this, 1); { return Container.calcRedstone(world.getTileEntity(pos)); }
CompoundNBT te_nbt = ((BTileEntity) te).clear_getnbt();
if(!te_nbt.isEmpty()) { @Override
CompoundNBT nbt = new CompoundNBT(); public boolean hasTileEntity(BlockState state)
nbt.put("tedata", te_nbt); { return true; }
stack.setTag(nbt);
} @Override
stacks.add(stack); @Nullable
} else { public TileEntity createTileEntity(BlockState state, IBlockReader world)
for(ItemStack stack: ((BTileEntity)te).stacks_) { { return new PlacerTileEntity(); }
if(!stack.isEmpty()) stacks.add(stack);
} @Override
((BTileEntity)te).reset_rtstate(); public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return;
((PlacerTileEntity)te).readnbt(te_nbt, false);
((PlacerTileEntity)te).reset_rtstate();
((PlacerTileEntity)te).markDirty();
} }
return stacks;
@Override
public boolean hasDynamicDropList()
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return stacks;
if(!explosion) {
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((PlacerTileEntity) te).clear_getnbt();
if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt);
stack.setTag(nbt);
}
stacks.add(stack);
} else {
for(ItemStack stack: ((PlacerTileEntity)te).stacks_) {
if(!stack.isEmpty()) stacks.add(stack);
}
((PlacerTileEntity)te).reset_rtstate();
}
return stacks;
}
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return;
((PlacerTileEntity)te).block_updated();
}
@Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
@Override
@SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
} }
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
if(!(world instanceof World) || (((World) world).isRemote)) return;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return;
((BTileEntity)te).block_updated();
}
@Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
@Override
@SuppressWarnings("deprecation")
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side)
{ return 0; }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory public static class PlacerTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory
{ {
public static final int TICK_INTERVAL = 40; public static final int TICK_INTERVAL = 40;
public static final int NUM_OF_SLOTS = 18; public static final int NUM_OF_SLOTS = 18;
@ -186,10 +193,10 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
// ModEngineersDecor.logger.info("Config factory placer:"); // ModEngineersDecor.logger.info("Config factory placer:");
} }
public BTileEntity() public PlacerTileEntity()
{ this(ModContent.TET_FACTORY_PLACER); } { this(ModContent.TET_FACTORY_PLACER); }
public BTileEntity(TileEntityType<?> te_type) public PlacerTileEntity(TileEntityType<?> te_type)
{ {
super(te_type); super(te_type);
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
@ -284,7 +291,7 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new PlacerContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------------------- // IInventory -------------------------------------------------------------------------------------------
@ -348,7 +355,7 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(BTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(PlacerTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
@ -554,7 +561,7 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
boolean trigger = (rssignal && ((block_power_updated_) || ((logic_ & LOGIC_CONTINUOUS)!=0))); boolean trigger = (rssignal && ((block_power_updated_) || ((logic_ & LOGIC_CONTINUOUS)!=0)));
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(state == null) { block_power_signal_= false; return; } if(state == null) { block_power_signal_= false; return; }
final Direction placer_facing = state.get(FACING); final Direction placer_facing = state.get(PlacerBlock.FACING);
// Trigger edge detection for next cycle // Trigger edge detection for next cycle
{ {
boolean tr = world.isBlockPowered(pos); boolean tr = world.isBlockPowered(pos);
@ -570,12 +577,12 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// container // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BContainer extends Container implements Networking.INetworkSynchronisableContainer public static class PlacerContainer extends Container implements Networking.INetworkSynchronisableContainer
{ {
private static final int PLAYER_INV_START_SLOTNO = BTileEntity.NUM_OF_SLOTS; private static final int PLAYER_INV_START_SLOTNO = PlacerTileEntity.NUM_OF_SLOTS;
private final PlayerEntity player_; private final PlayerEntity player_;
private final IInventory inventory_; private final IInventory inventory_;
private final IWorldPosCallable wpc_; private final IWorldPosCallable wpc_;
@ -583,10 +590,10 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
public final int field(int index) { return fields_.get(index); } public final int field(int index) { return fields_.get(index); }
public BContainer(int cid, PlayerInventory player_inventory) public PlacerContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(BTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(BTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(PlacerTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(PlacerTileEntity.NUM_OF_FIELDS)); }
private BContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private PlacerContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_FACTORY_PLACER, cid); super(ModContent.CT_FACTORY_PLACER, cid);
fields_ = fields; fields_ = fields;
@ -629,7 +636,7 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, PLAYER_INV_START_SLOTNO, PLAYER_INV_START_SLOTNO+36, false)) return ItemStack.EMPTY;
} else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) { } else if((index >= PLAYER_INV_START_SLOTNO) && (index <= PLAYER_INV_START_SLOTNO+36)) {
// Player slot // Player slot
if(!mergeItemStack(slot_stack, 0, BTileEntity.NUM_OF_SLOTS, false)) return ItemStack.EMPTY; if(!mergeItemStack(slot_stack, 0, PlacerTileEntity.NUM_OF_SLOTS, false)) return ItemStack.EMPTY;
} else { } else {
// invalid slot // invalid slot
return ItemStack.EMPTY; return ItemStack.EMPTY;
@ -665,8 +672,8 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
@Override @Override
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
{ {
if(!(inventory_ instanceof BTileEntity)) return; if(!(inventory_ instanceof PlacerTileEntity)) return;
BTileEntity te = (BTileEntity)inventory_; PlacerTileEntity te = (PlacerTileEntity)inventory_;
if(nbt.contains("logic")) te.logic_ = nbt.getInt("logic"); if(nbt.contains("logic")) te.logic_ = nbt.getInt("logic");
if(nbt.contains("manual_trigger") && (nbt.getInt("manual_trigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; } if(nbt.contains("manual_trigger") && (nbt.getInt("manual_trigger")!=0)) { te.block_power_signal_=true; te.block_power_updated_=true; te.tick_timer_=1; }
te.markDirty(); te.markDirty();
@ -678,11 +685,11 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class BGui extends ContainerScreen<BContainer> public static class PlacerGui extends ContainerScreen<PlacerContainer>
{ {
protected final PlayerEntity player_; protected final PlayerEntity player_;
public BGui(BContainer container, PlayerInventory player_inventory, ITextComponent title) public PlacerGui(PlacerContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; } { super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override @Override
@ -700,16 +707,16 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
{ {
BContainer container = (BContainer)getContainer(); PlacerContainer container = (PlacerContainer)getContainer();
int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5); int mx = (int)(mouseX - getGuiLeft() + .5), my = (int)(mouseY - getGuiTop() + .5);
if((!isPointInRegion(126, 1, 49, 60, mouseX, mouseY))) { if((!isPointInRegion(126, 1, 49, 60, mouseX, mouseY))) {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
} else if(isPointInRegion(133, 49, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(133, 49, 9, 9, mouseX, mouseY)) {
container.onGuiAction("manual_trigger", 1); container.onGuiAction("manual_trigger", 1);
} else if(isPointInRegion(145, 49, 9, 9, mouseX, mouseY)) { } else if(isPointInRegion(145, 49, 9, 9, mouseX, mouseY)) {
container.onGuiAction("logic", container.field(0) ^ BTileEntity.LOGIC_INVERTED); container.onGuiAction("logic", container.field(0) ^ PlacerTileEntity.LOGIC_INVERTED);
} else if(isPointInRegion(159, 49, 7, 9, mouseX, mouseY)) { } else if(isPointInRegion(159, 49, 7, 9, mouseX, mouseY)) {
container.onGuiAction("logic", container.field(0) ^ BTileEntity.LOGIC_CONTINUOUS); container.onGuiAction("logic", container.field(0) ^ PlacerTileEntity.LOGIC_CONTINUOUS);
} }
return true; return true;
} }
@ -722,11 +729,11 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_placer_gui.png")); this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/factory_placer_gui.png"));
final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize(); final int x0=getGuiLeft(), y0=getGuiTop(), w=getXSize(), h=getYSize();
blit(x0, y0, 0, 0, w, h); blit(x0, y0, 0, 0, w, h);
BContainer container = (BContainer)getContainer(); PlacerContainer container = (PlacerContainer)getContainer();
// active slot // active slot
{ {
int slot_index = container.field(2); int slot_index = container.field(2);
if((slot_index < 0) || (slot_index >= BTileEntity.NUM_OF_SLOTS)) slot_index = 0; if((slot_index < 0) || (slot_index >= PlacerTileEntity.NUM_OF_SLOTS)) slot_index = 0;
int x = (x0+10+((slot_index % 6) * 18)); int x = (x0+10+((slot_index % 6) * 18));
int y = (y0+8+((slot_index / 6) * 17)); int y = (y0+8+((slot_index / 6) * 17));
blit(x, y, 200, 8, 18, 18); blit(x, y, 200, 8, 18, 18);
@ -739,9 +746,9 @@ public class BlockDecorPlacer extends BlockDecor.Directed implements IDecorBlock
} }
// trigger logic // trigger logic
{ {
int inverter_offset = ((container.field(0) & BTileEntity.LOGIC_INVERTED) != 0) ? 11 : 0; int inverter_offset = ((container.field(0) & PlacerTileEntity.LOGIC_INVERTED) != 0) ? 11 : 0;
blit(x0+145, y0+49, 177+inverter_offset, 49, 9, 9); blit(x0+145, y0+49, 177+inverter_offset, 49, 9, 9);
int pulse_mode_offset = ((container.field(0) & BTileEntity.LOGIC_CONTINUOUS ) != 0) ? 9 : 0; int pulse_mode_offset = ((container.field(0) & PlacerTileEntity.LOGIC_CONTINUOUS ) != 0) ? 9 : 0;
blit(x0+159, y0+49, 199+pulse_mode_offset, 49, 9, 9); blit(x0+159, y0+49, 199+pulse_mode_offset, 49, 9, 9);
} }
RenderSystem.disableBlend(); RenderSystem.disableBlend();

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorSlab.java * @file EdSlabBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -11,8 +11,8 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.VariantSlabBlock; import wile.engineersdecor.libmc.blocks.VariantSlabBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
public class BlockDecorSlab extends VariantSlabBlock implements IDecorBlock public class EdSlabBlock extends VariantSlabBlock implements IDecorBlock
{ {
public BlockDecorSlab(long config, Block.Properties builder) public EdSlabBlock(long config, Block.Properties builder)
{ super(config, builder); } { super(config, builder); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorHalfSlab.java * @file EdSlabSliceBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -12,8 +12,8 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.SlabSliceBlock; import wile.engineersdecor.libmc.blocks.SlabSliceBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
public class BlockDecorHalfSlab extends SlabSliceBlock implements IDecorBlock public class EdSlabSliceBlock extends SlabSliceBlock implements IDecorBlock
{ {
public BlockDecorHalfSlab(long config, Block.Properties builder) public EdSlabSliceBlock(long config, Block.Properties builder)
{ super(config, builder); } { super(config, builder); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecor.Directed.java * @file EdSolarPanel.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -38,42 +38,49 @@ import net.minecraftforge.common.util.LazyOptional;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorSolarPanel extends BlockDecor implements IDecorBlock public class EdSolarPanel
{ {
public static final IntegerProperty EXPOSITION = IntegerProperty.create("exposition", 0, 4); //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorSolarPanel(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) public static class SolarPanelBlock extends DecorBlock.Normal implements IDecorBlock
{ {
super(config, builder, unrotatedAABB); public static final IntegerProperty EXPOSITION = IntegerProperty.create("exposition", 0, 4);
setDefaultState(stateContainer.getBaseState().with(EXPOSITION, 1));
}
@Override public SolarPanelBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
{ super.fillStateContainer(builder); builder.add(EXPOSITION); } super(config, builder, unrotatedAABB);
setDefaultState(stateContainer.getBaseState().with(EXPOSITION, 1));
}
@Override @Override
public boolean hasTileEntity(BlockState state) protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ return true; } { super.fillStateContainer(builder); builder.add(EXPOSITION); }
@Override @Override
@Nullable public boolean hasTileEntity(BlockState state)
public TileEntity createTileEntity(BlockState state, IBlockReader world) { return true; }
{ return new BlockDecorSolarPanel.BTileEntity(); }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) @Nullable
{ public TileEntity createTileEntity(BlockState state, IBlockReader world)
TileEntity te = world.getTileEntity(pos); { return new EdSolarPanel.SolarPanelTileEntity(); }
if(te instanceof BTileEntity) ((BTileEntity)te).state_message(player);
return ActionResultType.SUCCESS; @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof SolarPanelTileEntity) ((SolarPanelTileEntity)te).state_message(player);
return ActionResultType.SUCCESS;
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider, IEnergyStorage public static class SolarPanelTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider, IEnergyStorage
{ {
public static final int DEFAULT_PEAK_POWER = 45; public static final int DEFAULT_PEAK_POWER = 45;
public static final int TICK_INTERVAL = 8; public static final int TICK_INTERVAL = 8;
@ -97,10 +104,10 @@ public class BlockDecorSolarPanel extends BlockDecor implements IDecorBlock
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
public BTileEntity() public SolarPanelTileEntity()
{ this(ModContent.TET_SMALL_SOLAR_PANEL); } { this(ModContent.TET_SMALL_SOLAR_PANEL); }
public BTileEntity(TileEntityType<?> te_type) public SolarPanelTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void readnbt(CompoundNBT nbt, boolean update_packet) public void readnbt(CompoundNBT nbt, boolean update_packet)
@ -197,7 +204,7 @@ public class BlockDecorSolarPanel extends BlockDecor implements IDecorBlock
tick_timer_ = TICK_INTERVAL * 5; tick_timer_ = TICK_INTERVAL * 5;
current_production_ = 0; current_production_ = 0;
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if(state.get((EXPOSITION))!=2) world.setBlockState(pos, state.with(EXPOSITION, 2)); if(state.get((SolarPanelBlock.EXPOSITION))!=2) world.setBlockState(pos, state.with(SolarPanelBlock.EXPOSITION, 2));
return; return;
} }
if(--recalc_timer_ > 0) return; if(--recalc_timer_ > 0) return;
@ -211,7 +218,7 @@ public class BlockDecorSolarPanel extends BlockDecor implements IDecorBlock
else if(theta < 100) e = 2; else if(theta < 100) e = 2;
else if(theta < 135) e = 3; else if(theta < 135) e = 3;
else if(theta < 190) e = 4; else if(theta < 190) e = 4;
BlockState nstate = state.with(EXPOSITION, e); BlockState nstate = state.with(SolarPanelBlock.EXPOSITION, e);
if(nstate != state) world.setBlockState(pos, nstate, 1|2); if(nstate != state) world.setBlockState(pos, nstate, 1|2);
final double eff = (1.0-((world.getRainStrength(1f)*0.6)+(world.getThunderStrength(1f)*0.3))); final double eff = (1.0-((world.getRainStrength(1f)*0.6)+(world.getThunderStrength(1f)*0.3)));
final double ll = ((double)(world.getLightManager().getLightEngine(LightType.SKY).getLightFor(getPos())))/15; final double ll = ((double)(world.getLightManager().getLightEngine(LightType.SKY).getLightFor(getPos())))/15;

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorStairs.java * @file EdStairsBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -12,11 +12,11 @@ import wile.engineersdecor.libmc.blocks.StandardStairsBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
public class BlockDecorStairs extends StandardStairsBlock implements IDecorBlock public class EdStairsBlock extends StandardStairsBlock implements IDecorBlock
{ {
public BlockDecorStairs(long config, BlockState state, Block.Properties properties) public EdStairsBlock(long config, BlockState state, Block.Properties properties)
{ super(config, state, properties); } { super(config, state, properties); }
public BlockDecorStairs(long config, java.util.function.Supplier<BlockState> state, Block.Properties properties) public EdStairsBlock(long config, java.util.function.Supplier<BlockState> state, Block.Properties properties)
{ super(config, state, properties); } { super(config, state, properties); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorStraightPole.java * @file EdStraightPoleBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -18,9 +18,9 @@ import net.minecraft.util.math.BlockPos;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorStraightPole extends BlockDecor.DirectedWaterLoggable implements IDecorBlock public class EdStraightPoleBlock extends DecorBlock.DirectedWaterLoggable implements IDecorBlock
{ {
public BlockDecorStraightPole(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdStraightPoleBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override
@ -29,10 +29,10 @@ public class BlockDecorStraightPole extends BlockDecor.DirectedWaterLoggable imp
{ {
Direction facing = context.getFace(); Direction facing = context.getFace();
BlockState state = super.getStateForPlacement(context).with(FACING, facing); BlockState state = super.getStateForPlacement(context).with(FACING, facing);
if((config & BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME) != 0) { if((config & DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME) != 0) {
World world = context.getWorld(); World world = context.getWorld();
BlockPos pos = context.getPos(); BlockPos pos = context.getPos();
if(world.getBlockState(pos.offset(facing.getOpposite())).getBlock() instanceof BlockDecorStraightPole) { if(world.getBlockState(pos.offset(facing.getOpposite())).getBlock() instanceof EdStraightPoleBlock) {
state = state.with(FACING, state.get(FACING).getOpposite()); state = state.with(FACING, state.get(FACING).getOpposite());
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorTest.java * @file EdTestBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -44,55 +44,62 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BlockDecorTest extends BlockDecor.Directed implements Auxiliaries.IExperimentalFeature, IDecorBlock public class EdTestBlock
{ {
public BlockDecorTest(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) //--------------------------------------------------------------------------------------------------------------------
{ super(config, builder, unrotatedAABB); } // Block
//--------------------------------------------------------------------------------------------------------------------
@Override public static class TestBlock extends DecorBlock.Directed implements Auxiliaries.IExperimentalFeature, IDecorBlock
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
{ return VoxelShapes.fullCube(); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@Override
public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, @Nullable Direction side)
{ return true; }
@Override
public boolean hasDynamicDropList()
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
{ {
ArrayList<ItemStack> list = new ArrayList<ItemStack>(); public TestBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
list.add(new ItemStack(this, 1)); { super(config, builder, unrotatedAABB); }
return list;
}
@Override @Override
@SuppressWarnings("deprecation") public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { return VoxelShapes.fullCube(); }
{
TileEntity te = world.getTileEntity(pos); @Override
if(!(te instanceof BTileEntity)) return ActionResultType.SUCCESS; public boolean hasTileEntity(BlockState state)
((BTileEntity)te).activated(player, hand, hit); { return true; }
return ActionResultType.SUCCESS;
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new TestTileEntity(); }
@Override
public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, @Nullable Direction side)
{ return true; }
@Override
public boolean hasDynamicDropList()
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
{
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
list.add(new ItemStack(this, 1));
return list;
}
@Override
@SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof TestTileEntity)) return ActionResultType.SUCCESS;
((TestTileEntity)te).activated(player, hand, hit);
return ActionResultType.SUCCESS;
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider //, IItemHandler, IEnergyStorage public static class TestTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider //, IItemHandler, IEnergyStorage
{ {
private int tick_interval_ = 10; private int tick_interval_ = 10;
private int passive_tank_capacity_ = 32000; private int passive_tank_capacity_ = 32000;
@ -110,10 +117,10 @@ public class BlockDecorTest extends BlockDecor.Directed implements Auxiliaries.I
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
public BTileEntity() public TestTileEntity()
{ this(ModContent.TET_TEST_BLOCK); } { this(ModContent.TET_TEST_BLOCK); }
public BTileEntity(TileEntityType<?> te_type) public TestTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
@ -121,7 +128,7 @@ public class BlockDecorTest extends BlockDecor.Directed implements Auxiliaries.I
private Direction block_facing() private Direction block_facing()
{ {
BlockState st = getWorld().getBlockState(getPos()); BlockState st = getWorld().getBlockState(getPos());
return (st.getBlock() instanceof BlockDecorTest) ? st.get(FACING) : Direction.NORTH; return (st.getBlock() instanceof TestBlock) ? st.get(TestBlock.FACING) : Direction.NORTH;
} }
private String dump_fluid_stack(FluidStack fs) private String dump_fluid_stack(FluidStack fs)
@ -236,8 +243,8 @@ public class BlockDecorTest extends BlockDecor.Directed implements Auxiliaries.I
private static class MainFluidHandler implements IFluidHandler private static class MainFluidHandler implements IFluidHandler
{ {
private BTileEntity te; private TestTileEntity te;
public MainFluidHandler(BTileEntity te) public MainFluidHandler(TestTileEntity te)
{ this.te = te; } { this.te = te; }
@Override public int getTanks() @Override public int getTanks()

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorTreeCutter.java * @file EdTreeCutter.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -40,60 +40,67 @@ import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
public class BlockDecorTreeCutter extends BlockDecor.Horizontal implements IDecorBlock public class EdTreeCutter
{ {
public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorTreeCutter(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB) public static class TreeCutterBlock extends DecorBlock.Horizontal implements IDecorBlock
{ super(config, builder, unrotatedAABB); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(ACTIVE); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(ACTIVE, false); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BTileEntity(); }
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{ {
if((state.getBlock()!=this) || (!state.get(ACTIVE))) return; public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
final double rv = rnd.nextDouble();
if(rv > 0.8) return; public TreeCutterBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ(); { super(config, builder, unrotatedAABB); }
final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2);
switch(state.get(HORIZONTAL_FACING)) { @Override
case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break; protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break; { super.fillStateContainer(builder); builder.add(ACTIVE); }
case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break;
default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break; @Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(ACTIVE, false); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new TreeCutterTileEntity(); }
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{
if((state.getBlock()!=this) || (!state.get(ACTIVE))) return;
final double rv = rnd.nextDouble();
if(rv > 0.8) return;
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ();
final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2);
switch(state.get(HORIZONTAL_FACING)) {
case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break;
case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break;
case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break;
default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break;
}
} }
}
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(te instanceof BTileEntity) ((BTileEntity)te).state_message(player); if(te instanceof TreeCutterTileEntity) ((TreeCutterTileEntity)te).state_message(player);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage public static class TreeCutterTileEntity extends TileEntity implements ITickableTileEntity, IEnergyStorage
{ {
public static final int IDLE_TICK_INTERVAL = 40; public static final int IDLE_TICK_INTERVAL = 40;
public static final int TICK_INTERVAL = 5; public static final int TICK_INTERVAL = 5;
@ -119,10 +126,10 @@ public class BlockDecorTreeCutter extends BlockDecor.Horizontal implements IDeco
ModEngineersDecor.logger().info("Config tree cutter: Boost energy consumption:" + boost_energy_consumption + "rf/t" + (requires_power?" (power required for operation) ":"") + ", cutting time " + cutting_time_needed + "t." ); ModEngineersDecor.logger().info("Config tree cutter: Boost energy consumption:" + boost_energy_consumption + "rf/t" + (requires_power?" (power required for operation) ":"") + ", cutting time " + cutting_time_needed + "t." );
} }
public BTileEntity() public TreeCutterTileEntity()
{ super(ModContent.TET_SMALL_TREE_CUTTER); } { super(ModContent.TET_SMALL_TREE_CUTTER); }
public BTileEntity(TileEntityType<?> te_type) public TreeCutterTileEntity(TileEntityType<?> te_type)
{ super(te_type); } { super(te_type); }
public void readnbt(CompoundNBT nbt) public void readnbt(CompoundNBT nbt)
@ -206,7 +213,7 @@ public class BlockDecorTreeCutter extends BlockDecor.Horizontal implements IDeco
{ {
if(--tick_timer_ > 0) return; if(--tick_timer_ > 0) return;
if(world.isRemote) { if(world.isRemote) {
if(!world.getBlockState(pos).get(ACTIVE)) { if(!world.getBlockState(pos).get(TreeCutterBlock.ACTIVE)) {
tick_timer_ = TICK_INTERVAL; tick_timer_ = TICK_INTERVAL;
} else { } else {
tick_timer_ = 1; tick_timer_ = 1;
@ -215,10 +222,10 @@ public class BlockDecorTreeCutter extends BlockDecor.Horizontal implements IDeco
} else { } else {
tick_timer_ = TICK_INTERVAL; tick_timer_ = TICK_INTERVAL;
final BlockState device_state = world.getBlockState(pos); final BlockState device_state = world.getBlockState(pos);
final BlockPos tree_pos = pos.offset(device_state.get(HORIZONTAL_FACING)); final BlockPos tree_pos = pos.offset(device_state.get(TreeCutterBlock.HORIZONTAL_FACING));
final BlockState tree_state = world.getBlockState(tree_pos); final BlockState tree_state = world.getBlockState(tree_pos);
if(!TreeCutting.canChop(tree_state) || (world.isBlockPowered(pos))) { if(!TreeCutting.canChop(tree_state) || (world.isBlockPowered(pos))) {
if(device_state.get(ACTIVE)) world.setBlockState(pos, device_state.with(ACTIVE, false), 1|2); if(device_state.get(TreeCutterBlock.ACTIVE)) world.setBlockState(pos, device_state.with(TreeCutterBlock.ACTIVE, false), 1|2);
proc_time_elapsed_ = 0; proc_time_elapsed_ = 0;
active_timer_ = 0; active_timer_ = 0;
tick_timer_ = IDLE_TICK_INTERVAL; tick_timer_ = IDLE_TICK_INTERVAL;
@ -244,8 +251,8 @@ public class BlockDecorTreeCutter extends BlockDecor.Horizontal implements IDeco
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_WOOD_BREAK, SoundCategory.BLOCKS, 1.0f, 1.0f); world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_WOOD_BREAK, SoundCategory.BLOCKS, 1.0f, 1.0f);
active = false; active = false;
} }
if(device_state.get(ACTIVE) != active) { if(device_state.get(TreeCutterBlock.ACTIVE) != active) {
world.setBlockState(pos, device_state.with(ACTIVE, active), 1|2); world.setBlockState(pos, device_state.with(TreeCutterBlock.ACTIVE, active), 1|2);
} }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorWall.java * @file EdWallBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -11,8 +11,8 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.VariantWallBlock; import wile.engineersdecor.libmc.blocks.VariantWallBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
public class BlockDecorWall extends VariantWallBlock implements IDecorBlock public class EdWallBlock extends VariantWallBlock implements IDecorBlock
{ {
public BlockDecorWall(long config, Block.Properties builder) public EdWallBlock(long config, Block.Properties builder)
{ super(config, builder); } { super(config, builder); }
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorWasteIncinerator.java * @file EdWasteIncinerator.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -10,6 +10,7 @@ package wile.engineersdecor.blocks;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.EdFurnace.FurnaceBlock;
import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.libmc.detail.Inventories;
import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
@ -58,109 +59,116 @@ import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBlock public class EdWasteIncinerator
{ {
public static final BooleanProperty LIT = BlockDecorFurnace.DecorFurnaceBlock.LIT; //--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public BlockDecorWasteIncinerator(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public static class WasteIncineratorBlock extends DecorBlock.Normal implements IDecorBlock
{ super(config, builder, unrotatedAABB); }
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(LIT); }
@Override
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context)
{ return super.getStateForPlacement(context).with(LIT, false); }
@Override
@SuppressWarnings("deprecation")
public boolean hasComparatorInputOverride(BlockState state)
{ return true; }
@Override
@SuppressWarnings("deprecation")
public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
{ return Container.calcRedstone(world.getTileEntity(pos)); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new BlockDecorWasteIncinerator.BTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{ {
if(world.isRemote) return; public static final BooleanProperty LIT = FurnaceBlock.LIT;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BlockDecorWasteIncinerator.BTileEntity)) return;
((BlockDecorWasteIncinerator.BTileEntity)te).readnbt(te_nbt);
((BlockDecorWasteIncinerator.BTileEntity)te).markDirty();
}
@Override public WasteIncineratorBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
public boolean hasDynamicDropList() { super(config, builder, unrotatedAABB); }
{ return true; }
@Override @Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ { super.fillStateContainer(builder); builder.add(LIT); }
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks; @Override
final TileEntity te = world.getTileEntity(pos); @Nullable
if(!(te instanceof BTileEntity)) return stacks; public BlockState getStateForPlacement(BlockItemUseContext context)
if(!explosion) { { return super.getStateForPlacement(context).with(LIT, false); }
ItemStack stack = new ItemStack(this, 1);
CompoundNBT te_nbt = ((BTileEntity) te).reset_getnbt(); @Override
if(!te_nbt.isEmpty()) { @SuppressWarnings("deprecation")
CompoundNBT nbt = new CompoundNBT(); public boolean hasComparatorInputOverride(BlockState state)
nbt.put("tedata", te_nbt); { return true; }
stack.setTag(nbt);
} @Override
stacks.add(stack); @SuppressWarnings("deprecation")
} else { public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos)
for(ItemStack stack: ((BTileEntity)te).stacks_) stacks.add(stack); { return Container.calcRedstone(world.getTileEntity(pos)); }
((BTileEntity)te).reset_getnbt();
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new EdWasteIncinerator.WasteIncineratorTileEntity(); }
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
{
if(world.isRemote) return;
if((!stack.hasTag()) || (!stack.getTag().contains("tedata"))) return;
CompoundNBT te_nbt = stack.getTag().getCompound("tedata");
if(te_nbt.isEmpty()) return;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof EdWasteIncinerator.WasteIncineratorTileEntity)) return;
((EdWasteIncinerator.WasteIncineratorTileEntity)te).readnbt(te_nbt);
((EdWasteIncinerator.WasteIncineratorTileEntity)te).markDirty();
} }
return stacks;
}
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public boolean hasDynamicDropList()
{ { return true; }
if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof BTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS;
}
@Override @Override
@OnlyIn(Dist.CLIENT) public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd) {
{ final List<ItemStack> stacks = new ArrayList<ItemStack>();
if((state.getBlock()!=this) || (!state.get(LIT))) return; if(world.isRemote) return stacks;
final double rv = rnd.nextDouble(); final TileEntity te = world.getTileEntity(pos);
if(rv > 0.5) return; if(!(te instanceof WasteIncineratorTileEntity)) return stacks;
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ(); if(!explosion) {
final double xr=rnd.nextDouble()*0.4-0.2, yr=rnd.nextDouble()*0.5, zr=rnd.nextDouble()*0.4-0.2; ItemStack stack = new ItemStack(this, 1);
world.addParticle(ParticleTypes.SMOKE, x+xr, y+yr, z+zr, 0.0, 0.0, 0.0); CompoundNBT te_nbt = ((WasteIncineratorTileEntity) te).reset_getnbt();
if(!te_nbt.isEmpty()) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("tedata", te_nbt);
stack.setTag(nbt);
}
stacks.add(stack);
} else {
for(ItemStack stack: ((WasteIncineratorTileEntity)te).stacks_) stacks.add(stack);
((WasteIncineratorTileEntity)te).reset_getnbt();
}
return stacks;
}
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof WasteIncineratorTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS;
}
@Override
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rnd)
{
if((state.getBlock()!=this) || (!state.get(LIT))) return;
final double rv = rnd.nextDouble();
if(rv > 0.5) return;
final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ();
final double xr=rnd.nextDouble()*0.4-0.2, yr=rnd.nextDouble()*0.5, zr=rnd.nextDouble()*0.4-0.2;
world.addParticle(ParticleTypes.SMOKE, x+xr, y+yr, z+zr, 0.0, 0.0, 0.0);
}
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage public static class WasteIncineratorTileEntity extends TileEntity implements ITickableTileEntity, INameable, IInventory, INamedContainerProvider, ISidedInventory, IEnergyStorage
{ {
public static final int NUM_OF_FIELDS = 1; public static final int NUM_OF_FIELDS = 1;
public static final int TICK_INTERVAL = 20; public static final int TICK_INTERVAL = 20;
@ -183,17 +191,17 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
ModEngineersDecor.logger().info("Config waste incinerator boost energy consumption:" + energy_consumption); ModEngineersDecor.logger().info("Config waste incinerator boost energy consumption:" + energy_consumption);
} }
// BTileEntity ----------------------------------------------------------------------------- // WasteIncineratorTileEntity -----------------------------------------------------------------------------
private int tick_timer_; private int tick_timer_;
private int check_timer_; private int check_timer_;
private int energy_stored_; private int energy_stored_;
protected NonNullList<ItemStack> stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY); protected NonNullList<ItemStack> stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
public BTileEntity() public WasteIncineratorTileEntity()
{ this(ModContent.TET_WASTE_INCINERATOR); } { this(ModContent.TET_WASTE_INCINERATOR); }
public BTileEntity(TileEntityType<?> te_type) public WasteIncineratorTileEntity(TileEntityType<?> te_type)
{ super(te_type); reset(); } { super(te_type); reset(); }
public CompoundNBT reset_getnbt() public CompoundNBT reset_getnbt()
@ -266,7 +274,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
@Override @Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player ) public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player )
{ return new BlockDecorWasteIncinerator.BContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); } { return new EdWasteIncinerator.WasteIncineratorContainer(id, inventory, this, IWorldPosCallable.of(world, pos), fields); }
// IInventory ------------------------------------------------------------------------------ // IInventory ------------------------------------------------------------------------------
@ -328,7 +336,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
// Fields ----------------------------------------------------------------------------------------------- // Fields -----------------------------------------------------------------------------------------------
protected final IIntArray fields = new IntArray(BTileEntity.NUM_OF_FIELDS) protected final IIntArray fields = new IntArray(WasteIncineratorTileEntity.NUM_OF_FIELDS)
{ {
@Override @Override
public int get(int id) public int get(int id)
@ -398,9 +406,9 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
protected static class BItemHandler implements IItemHandler protected static class BItemHandler implements IItemHandler
{ {
private BTileEntity te; private WasteIncineratorTileEntity te;
BItemHandler(BTileEntity te) BItemHandler(WasteIncineratorTileEntity te)
{ this.te = te; } { this.te = te; }
@Override @Override
@ -480,7 +488,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
// Capability export ---------------------------------------------------------------------------- // Capability export ----------------------------------------------------------------------------
protected LazyOptional<IItemHandler> item_handler_ = LazyOptional.of(() -> new BTileEntity.BItemHandler(this)); protected LazyOptional<IItemHandler> item_handler_ = LazyOptional.of(() -> new WasteIncineratorTileEntity.BItemHandler(this));
protected LazyOptional<IEnergyStorage> energy_handler_ = LazyOptional.of(() -> (IEnergyStorage)this); protected LazyOptional<IEnergyStorage> energy_handler_ = LazyOptional.of(() -> (IEnergyStorage)this);
@Override @Override
@ -533,8 +541,8 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
if((was_processing != is_processing) || (new_stack_processing)) { if((was_processing != is_processing) || (new_stack_processing)) {
if(new_stack_processing) world.playSound(null, pos, SoundEvents.BLOCK_LAVA_AMBIENT, SoundCategory.BLOCKS, 0.05f, 2.4f); if(new_stack_processing) world.playSound(null, pos, SoundEvents.BLOCK_LAVA_AMBIENT, SoundCategory.BLOCKS, 0.05f, 2.4f);
final BlockState state = world.getBlockState(pos); final BlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockDecorWasteIncinerator) { if(state.getBlock() instanceof WasteIncineratorBlock) {
world.setBlockState(pos, state.with(LIT, is_processing), 2|16); world.setBlockState(pos, state.with(WasteIncineratorBlock.LIT, is_processing), 2|16);
} }
} }
if(dirty) markDirty(); if(dirty) markDirty();
@ -585,52 +593,15 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
} }
return changed; return changed;
} }
} }
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
// GUI // Container
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) public static class WasteIncineratorContainer extends Container
public static class BGui extends ContainerScreen<BContainer>
{ {
protected final PlayerEntity player_; private static final int PLAYER_INV_START_SLOTNO = WasteIncineratorTileEntity.NUM_OF_SLOTS;
public BGui(BContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override
public void init()
{ super.init(); }
@Override
public void render(int mouseX, int mouseY, float partialTicks)
{
renderBackground();
super.render(mouseX, mouseY, partialTicks);
renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
RenderSystem.enableBlend();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/small_waste_incinerator_gui.png"));
final int x0=guiLeft, y0=this.guiTop, w=xSize, h=ySize;
blit(x0, y0, 0, 0, w, h);
RenderSystem.disableBlend();
}
}
//--------------------------------------------------------------------------------------------------------------------
// container
//--------------------------------------------------------------------------------------------------------------------
public static class BContainer extends Container
{
private static final int PLAYER_INV_START_SLOTNO = BTileEntity.NUM_OF_SLOTS;
protected final PlayerEntity player_; protected final PlayerEntity player_;
protected final IInventory inventory_; protected final IInventory inventory_;
protected final IWorldPosCallable wpc_; protected final IWorldPosCallable wpc_;
@ -642,10 +613,10 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
public IInventory inventory() { return inventory_ ; } public IInventory inventory() { return inventory_ ; }
public World world() { return player_.world; } public World world() { return player_.world; }
public BContainer(int cid, PlayerInventory player_inventory) public WasteIncineratorContainer(int cid, PlayerInventory player_inventory)
{ this(cid, player_inventory, new Inventory(BTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(BTileEntity.NUM_OF_FIELDS)); } { this(cid, player_inventory, new Inventory(WasteIncineratorTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY, new IntArray(WasteIncineratorTileEntity.NUM_OF_FIELDS)); }
private BContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields) private WasteIncineratorContainer(int cid, PlayerInventory player_inventory, IInventory block_inventory, IWorldPosCallable wpc, IIntArray fields)
{ {
super(ModContent.CT_WASTE_INCINERATOR, cid); super(ModContent.CT_WASTE_INCINERATOR, cid);
player_ = player_inventory.player; player_ = player_inventory.player;
@ -711,4 +682,40 @@ public class BlockDecorWasteIncinerator extends BlockDecor implements IDecorBloc
} }
} }
//--------------------------------------------------------------------------------------------------------------------
// GUI
//--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT)
public static class WasteIncineratorGui extends ContainerScreen<WasteIncineratorContainer>
{
protected final PlayerEntity player_;
public WasteIncineratorGui(WasteIncineratorContainer container, PlayerInventory player_inventory, ITextComponent title)
{ super(container, player_inventory, title); this.player_ = player_inventory.player; }
@Override
public void init()
{ super.init(); }
@Override
public void render(int mouseX, int mouseY, float partialTicks)
{
renderBackground();
super.render(mouseX, mouseY, partialTicks);
renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
RenderSystem.enableBlend();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/small_waste_incinerator_gui.png"));
final int x0=guiLeft, y0=this.guiTop, w=xSize, h=ySize;
blit(x0, y0, 0, 0, w, h);
RenderSystem.disableBlend();
}
}
} }

View file

@ -1,5 +1,5 @@
/* /*
* @file BlockDecorWindow.java * @file EdWindowBlock.java
* @author Stefan Wilhelm (wile) * @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm * @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT) * @license MIT (see https://opensource.org/licenses/MIT)
@ -16,9 +16,9 @@ import net.minecraft.util.math.AxisAlignedBB;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockDecorWindow extends BlockDecor.DirectedWaterLoggable implements IDecorBlock public class EdWindowBlock extends DecorBlock.DirectedWaterLoggable implements IDecorBlock
{ {
public BlockDecorWindow(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) public EdWindowBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
{ super(config, builder, unrotatedAABB); } { super(config, builder, unrotatedAABB); }
@Override @Override

View file

@ -11,8 +11,9 @@ package wile.engineersdecor.detail;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.registries.ObjectHolder;
public class ExtItems public class ExternalObjects
{ {
@ObjectHolder("immersiveengineering:external_heater") @ObjectHolder("immersiveengineering:external_heater")
public static final Item IE_EXTERNAL_HEATER = null; public static final Item IE_EXTERNAL_HEATER = null;

View file

@ -10,7 +10,7 @@
package wile.engineersdecor.detail; package wile.engineersdecor.detail;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.BlockDecorCraftingTable; import wile.engineersdecor.blocks.EdCraftingTable;
import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.EntityRendererManager;
@ -26,8 +26,8 @@ import net.minecraft.util.math.MathHelper;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import wile.engineersdecor.blocks.BlockDecorCraftingTable.CraftingTableBlock; import wile.engineersdecor.blocks.EdCraftingTable.CraftingTableBlock;
import wile.engineersdecor.blocks.BlockDecorLabeledCrate; import wile.engineersdecor.blocks.EdLabeledCrate;
public class ModRenderers public class ModRenderers
@ -66,7 +66,7 @@ public class ModRenderers
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class CraftingTableTer extends TileEntityRenderer<BlockDecorCraftingTable.CraftingTableTileEntity> public static class CraftingTableTer extends TileEntityRenderer<EdCraftingTable.CraftingTableTileEntity>
{ {
private static int tesr_error_counter = 4; private static int tesr_error_counter = 4;
private static float scaler = 0.1f; private static float scaler = 0.1f;
@ -84,7 +84,7 @@ public class ModRenderers
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void render(final BlockDecorCraftingTable.CraftingTableTileEntity te, float unused1, MatrixStack mxs, IRenderTypeBuffer buf, int i5, int i6) public void render(final EdCraftingTable.CraftingTableTileEntity te, float unused1, MatrixStack mxs, IRenderTypeBuffer buf, int i5, int i6)
{ {
if(tesr_error_counter <= 0) return; if(tesr_error_counter <= 0) return;
try { try {
@ -123,7 +123,7 @@ public class ModRenderers
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class DecorLabeledCrateTer extends TileEntityRenderer<BlockDecorLabeledCrate.LabeledCrateTileEntity> public static class DecorLabeledCrateTer extends TileEntityRenderer<EdLabeledCrate.LabeledCrateTileEntity>
{ {
private static int tesr_error_counter = 4; private static int tesr_error_counter = 4;
private static float scaler = 0.35f; private static float scaler = 0.35f;
@ -139,13 +139,13 @@ public class ModRenderers
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void render(final BlockDecorLabeledCrate.LabeledCrateTileEntity te, float unused1, MatrixStack mxs, IRenderTypeBuffer buf, int i5, int i6) public void render(final EdLabeledCrate.LabeledCrateTileEntity te, float unused1, MatrixStack mxs, IRenderTypeBuffer buf, int i5, int i6)
{ {
if(tesr_error_counter<=0) return; if(tesr_error_counter<=0) return;
try { try {
final ItemStack stack = te.getItemFrameStack(); final ItemStack stack = te.getItemFrameStack();
if(stack.isEmpty()) return; if(stack.isEmpty()) return;
final int di = MathHelper.clamp(te.getWorld().getBlockState(te.getPos()).get(BlockDecorLabeledCrate.DecorLabeledCrateBlock.HORIZONTAL_FACING).getHorizontalIndex(), 0, 3); final int di = MathHelper.clamp(te.getWorld().getBlockState(te.getPos()).get(EdLabeledCrate.DecorLabeledCrateBlock.HORIZONTAL_FACING).getHorizontalIndex(), 0, 3);
double ox = tr[di][0], oy = tr[di][1], oz = tr[di][2]; double ox = tr[di][0], oy = tr[di][1], oz = tr[di][2];
float ry = (float)tr[di][3]; float ry = (float)tr[di][3];
mxs.push(); mxs.push();

View file

@ -9,9 +9,9 @@
package wile.engineersdecor.eapi.jei; package wile.engineersdecor.eapi.jei;
import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.BlockDecorCraftingTable; import wile.engineersdecor.ModConfig;
import wile.engineersdecor.detail.ModConfig;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.blocks.EdCraftingTable;
import mezz.jei.api.constants.VanillaRecipeCategoryUid; import mezz.jei.api.constants.VanillaRecipeCategoryUid;
import mezz.jei.api.registration.IRecipeTransferRegistration; import mezz.jei.api.registration.IRecipeTransferRegistration;
import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.constants.VanillaTypes;
@ -36,7 +36,7 @@ public class JEIPlugin implements mezz.jei.api.IModPlugin
if(!ModConfig.without_crafting_table) { if(!ModConfig.without_crafting_table) {
try { try {
registration.addRecipeTransferHandler( registration.addRecipeTransferHandler(
BlockDecorCraftingTable.CraftingTableContainer.class, EdCraftingTable.CraftingTableContainer.class,
VanillaRecipeCategoryUid.CRAFTING, VanillaRecipeCategoryUid.CRAFTING,
1, 9, 10, 44 1, 9, 10, 44
); );

View file

@ -10,29 +10,25 @@
package wile.engineersdecor.libmc.blocks; package wile.engineersdecor.libmc.blocks;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.item.*;
import net.minecraft.util.math.*;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState; import net.minecraft.fluid.IFluidState;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IntegerProperty; import net.minecraft.state.IntegerProperty;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -114,9 +110,39 @@ public class SlabSliceBlock extends StandardBlocks.WaterLoggable implements Stan
@Nullable @Nullable
public BlockState getStateForPlacement(BlockItemUseContext context) public BlockState getStateForPlacement(BlockItemUseContext context)
{ {
final Direction facing = context.getFace(); final BlockPos pos = context.getPos();
double y = context.getHitVec().getY(); BlockState state = context.getWorld().getBlockState(pos);
return super.getStateForPlacement(context).with(PARTS, ((facing==Direction.UP) || ((facing!=Direction.DOWN) && (y < 0.6))) ? 0 : 14); if(state.getBlock() == this) {
int parts = state.get(PARTS);
if(parts == 7) return null; // -> is already a full block.
parts += (parts < 7) ? 1 : -1;
if(parts==7) state = state.with(WATERLOGGED, false);
return state.with(PARTS, parts);
} else {
final Direction face = context.getFace();
final BlockState placement_state = super.getStateForPlacement(context); // fluid state
if(face == Direction.UP) return placement_state.with(PARTS, 0);
if(face == Direction.DOWN) return placement_state.with(PARTS, 14);
if(!face.getAxis().isHorizontal()) return placement_state;
final boolean isupper = ((context.getHitVec().getY() - context.getPos().getY()) > 0.5);
return placement_state.with(PARTS, isupper ? 14 : 0);
}
}
@Override
@SuppressWarnings("deprecation")
public boolean isReplaceable(BlockState state, BlockItemUseContext context)
{
if(context.getItem().getItem() != this.asItem()) return false;
if(!context.replacingClickedOnBlock()) return true;
final Direction face = context.getFace();
final int parts = state.get(PARTS);
if(parts == 7) return false;
if((face == Direction.UP) && (parts < 7)) return true;
if((face == Direction.DOWN) && (parts > 7)) return true;
if(!face.getAxis().isHorizontal()) return false;
final boolean isupper = ((context.getHitVec().getY() - context.getPos().getY()) > 0.5);
return isupper ? (parts==0) : (parts==1);
} }
@Override @Override
@ -137,31 +163,6 @@ public class SlabSliceBlock extends StandardBlocks.WaterLoggable implements Stan
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion) public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, boolean explosion)
{ return new ArrayList<ItemStack>(Collections.singletonList(new ItemStack(this.asItem(), num_slabs_contained_in_parts_[state.get(PARTS) & 0xf]))); } { return new ArrayList<ItemStack>(Collections.singletonList(new ItemStack(this.asItem(), num_slabs_contained_in_parts_[state.get(PARTS) & 0xf]))); }
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
Direction face = rayTraceResult.getFace();
final ItemStack stack = player.getHeldItem(hand);
if(stack.isEmpty() || (Block.getBlockFromItem(stack.getItem()) != this)) return ActionResultType.PASS;
if((face != Direction.UP) && (face != Direction.DOWN)) return ActionResultType.PASS;
int parts = state.get(PARTS);
if((face != Direction.UP) && (parts > 7)) {
world.setBlockState(pos, state.with(PARTS, parts-1), 3);
} else if((face != Direction.DOWN) && (parts < 7)) {
world.setBlockState(pos, state.with(PARTS, parts+1), 3);
} else {
return (parts != 7) ? ActionResultType.SUCCESS : ActionResultType.PASS;
}
if(world.isRemote) return ActionResultType.SUCCESS;
if(!player.isCreative()) {
stack.shrink(1);
if(player.inventory != null) player.inventory.markDirty();
}
SoundType st = this.getSoundType(state, world, pos, null);
world.playSound(null, pos, st.getPlaceSound(), SoundCategory.BLOCKS, (st.getVolume()+1f)/2.5f, 0.9f*st.getPitch());
return ActionResultType.SUCCESS;
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void onBlockClicked(BlockState state, World world, BlockPos pos, PlayerEntity player) public void onBlockClicked(BlockState state, World world, BlockPos pos, PlayerEntity player)

View file

@ -12,6 +12,8 @@
*/ */
package wile.engineersdecor.libmc.blocks; package wile.engineersdecor.libmc.blocks;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
@ -78,6 +80,12 @@ public class StandardBlocks
{ return RenderTypeHint.SOLID; } { return RenderTypeHint.SOLID; }
} }
public interface IBlockItemFactory
{
// BlockItem factory for item registry. Only invoked once.
BlockItem getBlockItem(Block blockIn, Item.Properties builder);
}
public static class BaseBlock extends Block implements IStandardBlock public static class BaseBlock extends Block implements IStandardBlock
{ {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;

View file

@ -6,10 +6,9 @@
# Note for reviewers/clones: This file is a auxiliary script for my setup. # Note for reviewers/clones: This file is a auxiliary script for my setup.
# It's not needed to build the mod. # It's not needed to build the mod.
# #
.PHONY: default init clean clean-all mrproper sanatize dist update-json sync-main-repo compare migrate-from-112 .PHONY: default init clean clean-all mrproper sanatize dist dist-all update-json sync-main-repo compare migrate-from-112
default: ; @echo "First change to specific version directory." default: ; @echo "First change to specific version directory."
init: default
dist: default dist: default
clean: clean:
@ -37,6 +36,16 @@ sanatize:
@cd 1.15; make -s sanatize @cd 1.15; make -s sanatize
@make -s update-json @make -s update-json
init:
-@cd 1.12; make -s init
-@cd 1.14; make -s init
-@cd 1.15; make -s init
dist-all: clean-all init
-@cd 1.12; make -s dist
-@cd 1.14; make -s dist
-@cd 1.15; make -s dist
compare: compare:
@djs tasks.js compare-blockstates -v @djs tasks.js compare-blockstates -v
@djs tasks.js compare-textures -v @djs tasks.js compare-textures -v

View file

@ -2,13 +2,14 @@
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"promos": { "promos": {
"1.12.2-recommended": "1.0.19", "1.12.2-recommended": "1.0.19",
"1.12.2-latest": "1.0.20-b5", "1.12.2-latest": "1.0.20-b6",
"1.14.4-recommended": "", "1.14.4-recommended": "",
"1.14.4-latest": "1.0.20-b5", "1.14.4-latest": "1.0.20-b6",
"1.15.2-recommended": "", "1.15.2-recommended": "",
"1.15.2-latest": "1.0.20-b5" "1.15.2-latest": "1.0.20-b6"
}, },
"1.12.2": { "1.12.2": {
"1.0.20-b6": "[F] Implemented compat related to issue #91.",
"1.0.20-b5": "[A] Back-ported Patchouli based Manual (you need to install Vazkii_'s Patchouli, too).\n[A] Back-ported Steel Mesh Fence Gate.\n[M] Minor back-porting compatibility refractoring.", "1.0.20-b5": "[A] Back-ported Patchouli based Manual (you need to install Vazkii_'s Patchouli, too).\n[A] Back-ported Steel Mesh Fence Gate.\n[M] Minor back-porting compatibility refractoring.",
"1.0.20-b4": "[F] Fixed TE registration bug for Crate registry-optout (issue #91, thx tyon2006).", "1.0.20-b4": "[F] Fixed TE registration bug for Crate registry-optout (issue #91, thx tyon2006).",
"1.0.20-b3": "[/] Version skipped for 1.12.2.", "1.0.20-b3": "[/] Version skipped for 1.12.2.",
@ -94,6 +95,7 @@
"1.0.0-b1": "[A] Initial structure.\n[A] Added clinker bricks and clinker brick stairs.\n[A] Added slag bricks and slag brick stairs.\n[A] Added metal rung ladder.\n[A] Added staggered metal steps ladder.\n[A] Added treated wood ladder.\n[A] Added treated wood pole.\n[A] Added treated wood table." "1.0.0-b1": "[A] Initial structure.\n[A] Added clinker bricks and clinker brick stairs.\n[A] Added slag bricks and slag brick stairs.\n[A] Added metal rung ladder.\n[A] Added staggered metal steps ladder.\n[A] Added treated wood ladder.\n[A] Added treated wood pole.\n[A] Added treated wood table."
}, },
"1.14.4": { "1.14.4": {
"1.0.20-b6": "[M] Slab Slice placement improved.\n[M] Quite some naming/refractoring under the hood.",
"1.0.20-b5": "[A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a Hopper is placed in the auxiliary slot.\n[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.", "1.0.20-b5": "[A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a Hopper is placed in the auxiliary slot.\n[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.",
"1.0.20-b4": "[F] Fixed Mineral Smelter fluid voiding on external draining (issue #92, thx papaworld, pupnewfster).", "1.0.20-b4": "[F] Fixed Mineral Smelter fluid voiding on external draining (issue #92, thx papaworld, pupnewfster).",
"1.0.20-b3": "[M] Labeled Crate: GUI quick-move-all (ctrl-shift click) smart move tweaked, Manual page added.\n[F] Fixed IE ingredients based default recipes for Factory Dropper and Small Electrical Furnace.\n[M] Factory Hopper: GUI quick-move-all added.\n[M] Code structure, simplifications, cap invalidation fixes.\n[M] Valves: Removed performance caching for testing purposes.", "1.0.20-b3": "[M] Labeled Crate: GUI quick-move-all (ctrl-shift click) smart move tweaked, Manual page added.\n[F] Fixed IE ingredients based default recipes for Factory Dropper and Small Electrical Furnace.\n[M] Factory Hopper: GUI quick-move-all added.\n[M] Code structure, simplifications, cap invalidation fixes.\n[M] Valves: Removed performance caching for testing purposes.",
@ -146,6 +148,7 @@
"1.0.7-b3": "[A] Initial 1.14.2 port of decorative blocks." "1.0.7-b3": "[A] Initial 1.14.2 port of decorative blocks."
}, },
"1.15.2": { "1.15.2": {
"1.0.20-b6": "[M] Slab Slice placement improved.\n[M] Quite some naming/refractoring under the hood.",
"1.0.20-b5": "[A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a Hopper is placed in the auxiliary slot.\n[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.", "1.0.20-b5": "[A] Electrical Furnace can draw in smelting input items from an adjacent inventory when a Hopper is placed in the auxiliary slot.\n[M] Wrapped Labeled Crate label slot to prevent sorting mods from altering the label.",
"1.0.20-b4": "[F] Fixed Mineral Smelter fluid voiding on external draining (issue #92, thx papaworld, pupnewfster).", "1.0.20-b4": "[F] Fixed Mineral Smelter fluid voiding on external draining (issue #92, thx papaworld, pupnewfster).",
"1.0.20-b3": "[M] Labeled Crate: GUI quick-move-all (ctrl-shift click) smart move tweaked, Manual page added.\n[F] Fixed IE ingredients based default recipes for Factory Dropper and Small Electrical Furnace.\n[M] Factory Hopper: GUI quick-move-all added.\n[M] Code structure, simplifications, cap invalidation fixes.\n[M] Valves: Removed performance caching for testing purposes.", "1.0.20-b3": "[M] Labeled Crate: GUI quick-move-all (ctrl-shift click) smart move tweaked, Manual page added.\n[F] Fixed IE ingredients based default recipes for Factory Dropper and Small Electrical Furnace.\n[M] Factory Hopper: GUI quick-move-all added.\n[M] Code structure, simplifications, cap invalidation fixes.\n[M] Valves: Removed performance caching for testing purposes.",