-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'IF/1.16' into 1.16
- Loading branch information
Showing
11 changed files
with
337 additions
and
2 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/generated/resources/assets/industrialforegoing/blockstates/wither_builder.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"variants": { | ||
"subfacing=north": { | ||
"model": "industrialforegoing:block/wither_builder" | ||
}, | ||
"subfacing=south": { | ||
"model": "industrialforegoing:block/wither_builder", | ||
"y": 180 | ||
}, | ||
"subfacing=west": { | ||
"model": "industrialforegoing:block/wither_builder", | ||
"y": 270 | ||
}, | ||
"subfacing=east": { | ||
"model": "industrialforegoing:block/wither_builder", | ||
"y": 90 | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/generated/resources/assets/industrialforegoing/models/item/wither_builder.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"parent": "industrialforegoing:block/wither_builder" | ||
} |
19 changes: 19 additions & 0 deletions
19
src/generated/resources/data/industrialforegoing/loot_tables/blocks/wither_builder.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"rolls": 1, | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "industrialforegoing:wither_builder" | ||
} | ||
], | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
] | ||
} | ||
] | ||
} |
46 changes: 46 additions & 0 deletions
46
src/generated/resources/data/industrialforegoing/recipes/wither_builder.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"type": "forge:conditional", | ||
"recipes": [ | ||
{ | ||
"conditions": [ | ||
{ | ||
"values": [ | ||
{ | ||
"item": "industrialforegoing:wither_builder", | ||
"type": "forge:item_exists" | ||
} | ||
], | ||
"type": "forge:and" | ||
} | ||
], | ||
"recipe": { | ||
"type": "minecraft:crafting_shaped", | ||
"pattern": [ | ||
"PNP", | ||
"WCW", | ||
"SSS" | ||
], | ||
"key": { | ||
"P": { | ||
"tag": "forge:plastic" | ||
}, | ||
"N": { | ||
"item": "minecraft:nether_star" | ||
}, | ||
"W": { | ||
"item": "minecraft:wither_skeleton_skull" | ||
}, | ||
"C": { | ||
"tag": "industrialforegoing:machine_frame/supreme" | ||
}, | ||
"S": { | ||
"item": "minecraft:soul_sand" | ||
} | ||
}, | ||
"result": { | ||
"item": "industrialforegoing:wither_builder" | ||
} | ||
} | ||
} | ||
] | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/com/buuz135/industrial/block/agriculturehusbandry/WitherBuilderBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.buuz135.industrial.block.agriculturehusbandry; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import com.buuz135.industrial.block.IndustrialBlock; | ||
import com.buuz135.industrial.block.agriculturehusbandry.tile.WitherBuilderTile; | ||
import com.buuz135.industrial.module.ModuleAgricultureHusbandry; | ||
import com.buuz135.industrial.utils.IndustrialTags; | ||
import com.hrznstudio.titanium.api.IFactory; | ||
import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; | ||
|
||
import net.minecraft.block.Blocks; | ||
import net.minecraft.data.IFinishedRecipe; | ||
import net.minecraft.item.Items; | ||
|
||
public class WitherBuilderBlock extends IndustrialBlock<WitherBuilderTile> { | ||
|
||
public WitherBuilderBlock() { | ||
super("wither_builder", Properties.from(Blocks.IRON_BLOCK), WitherBuilderTile.class, ModuleAgricultureHusbandry.TAB_AG_HUS); | ||
} | ||
|
||
@Override | ||
public IFactory<WitherBuilderTile> getTileEntityFactory() { | ||
return WitherBuilderTile::new; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public RotationType getRotationType() { | ||
return RotationType.FOUR_WAY; | ||
} | ||
|
||
@Override | ||
public void registerRecipe(Consumer<IFinishedRecipe> consumer) { | ||
TitaniumShapedRecipeBuilder.shapedRecipe(this) | ||
.patternLine("PNP").patternLine("WCW").patternLine("SSS") | ||
.key('P', IndustrialTags.Items.PLASTIC) | ||
.key('N', Items.NETHER_STAR) | ||
.key('W', Items.WITHER_SKELETON_SKULL) | ||
.key('C', IndustrialTags.Items.MACHINE_FRAME_SUPREME) | ||
.key('S', Blocks.SOUL_SAND) | ||
.build(consumer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165 changes: 165 additions & 0 deletions
165
src/main/java/com/buuz135/industrial/block/agriculturehusbandry/tile/WitherBuilderTile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
package com.buuz135.industrial.block.agriculturehusbandry.tile; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import com.buuz135.industrial.IndustrialForegoing; | ||
import com.buuz135.industrial.block.tile.IndustrialAreaWorkingTile; | ||
import com.buuz135.industrial.block.tile.RangeManager; | ||
import com.buuz135.industrial.config.machine.agriculturehusbandry.MobDuplicatorConfig; | ||
import com.buuz135.industrial.config.machine.agriculturehusbandry.WitherBuilderConfig; | ||
import com.buuz135.industrial.module.ModuleAgricultureHusbandry; | ||
import com.buuz135.industrial.utils.IFFakePlayer; | ||
import com.hrznstudio.titanium.annotation.Save; | ||
import com.hrznstudio.titanium.component.energy.EnergyStorageComponent; | ||
import com.hrznstudio.titanium.component.inventory.SidedInventoryComponent; | ||
import net.minecraftforge.items.ItemStackHandler; | ||
|
||
import net.minecraft.block.Blocks; | ||
import net.minecraft.item.DyeColor; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.util.Direction; | ||
import net.minecraft.util.math.AxisAlignedBB; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.shapes.VoxelShape; | ||
|
||
public class WitherBuilderTile extends IndustrialAreaWorkingTile<WitherBuilderTile> { | ||
|
||
@Save | ||
private SidedInventoryComponent<WitherBuilderTile> top; | ||
|
||
@Save | ||
private SidedInventoryComponent<WitherBuilderTile> middle; | ||
|
||
@Save | ||
private SidedInventoryComponent<WitherBuilderTile> bottom; | ||
|
||
public WitherBuilderTile() { | ||
super(ModuleAgricultureHusbandry.WITHER_BUILDER, RangeManager.RangeType.TOP_UP, true, WitherBuilderConfig.powerPerOperation); | ||
|
||
|
||
this.addInventory(top = (SidedInventoryComponent<WitherBuilderTile>) new SidedInventoryComponent<WitherBuilderTile>("wither_skulls", 64, 25, 3, 0) | ||
.setColor(DyeColor.BLACK) | ||
.setInputFilter((itemStack, integer) -> itemStack.getItem().equals(Items.WITHER_SKELETON_SKULL)) | ||
.setSlotLimit(1) | ||
.setComponentHarness(this) | ||
); | ||
this.addInventory(middle = (SidedInventoryComponent<WitherBuilderTile>) new SidedInventoryComponent<WitherBuilderTile>("soulsand", 64, 25 + 18, 3, 1) | ||
.setColor(DyeColor.ORANGE) | ||
.setInputFilter((itemStack, integer) -> itemStack.getItem().equals(Blocks.SOUL_SAND.asItem())) | ||
.setSlotLimit(1) | ||
.setComponentHarness(this) | ||
); | ||
this.addInventory(bottom = (SidedInventoryComponent<WitherBuilderTile>) new SidedInventoryComponent<WitherBuilderTile>("soulsand", 64 + 18, 25 + 18 * 2, 1, 2) | ||
.setColor(DyeColor.ORANGE) | ||
.setInputFilter((itemStack, integer) -> itemStack.getItem().equals(Blocks.SOUL_SAND.asItem())) | ||
.setSlotLimit(1) | ||
.setComponentHarness(this) | ||
); | ||
} | ||
|
||
@Override | ||
public WorkAction work() { | ||
if (!hasEnergy(WitherBuilderConfig.powerPerOperation)) return new WorkAction(1, 0); | ||
BlockPos pos = this.pos.add(0, 2, 0); | ||
float power = 0; | ||
if (this.world.getBlockState(pos).getBlock().equals(Blocks.AIR) && !getDefaultOrFind(0, bottom, new ItemStack(Blocks.SOUL_SAND)).isEmpty()) { | ||
this.world.setBlockState(pos, Blocks.SOUL_SAND.getDefaultState()); | ||
getDefaultOrFind(0, bottom, new ItemStack(Blocks.SOUL_SAND)).shrink(1); | ||
power += 1 / 7f; | ||
} | ||
if (this.world.getBlockState(pos).getBlock().equals(Blocks.SOUL_SAND)) { | ||
for (int i = 0; i < 3; ++i) { | ||
BlockPos temp; | ||
if (getFacingDirection() == Direction.EAST || getFacingDirection() == Direction.WEST) { | ||
temp = pos.add(0, 1, i - 1); | ||
} else { | ||
temp = pos.add(i - 1, 1, 0); | ||
} | ||
if (this.world.getBlockState(temp).getBlock().equals(Blocks.AIR) && !getDefaultOrFind(i, middle, new ItemStack(Blocks.SOUL_SAND)).isEmpty()) { | ||
this.world.setBlockState(temp, Blocks.SOUL_SAND.getDefaultState()); | ||
getDefaultOrFind(i, middle, new ItemStack(Blocks.SOUL_SAND)).shrink(1); | ||
power += 1 / 7f; | ||
} | ||
} | ||
} | ||
if (this.world.getBlockState(pos).getBlock().equals(Blocks.SOUL_SAND)) { | ||
boolean secondRow = true; | ||
for (int i = 0; i < 3; ++i) { | ||
BlockPos temp; | ||
if (getFacingDirection() == Direction.EAST || getFacingDirection() == Direction.WEST) { | ||
temp = pos.add(0, 1, i - 1); | ||
} else { | ||
temp = pos.add(i - 1, 1, 0); | ||
} | ||
if (!this.world.getBlockState(temp).getBlock().equals(Blocks.SOUL_SAND)) { | ||
secondRow = false; | ||
break; | ||
} | ||
} | ||
if (secondRow) { | ||
for (int i = 0; i < 3; ++i) { | ||
BlockPos temp; | ||
if (getFacingDirection() == Direction.EAST || getFacingDirection() == Direction.WEST) { | ||
temp = pos.add(0, 2, i - 1); | ||
} else { | ||
temp = pos.add(i - 1, 2, 0); | ||
} | ||
if (this.world.getBlockState(temp).getBlock().equals(Blocks.AIR) && !getDefaultOrFind(i, top, new ItemStack(Items.WITHER_SKELETON_SKULL)).isEmpty() && this.world.getBlockState(temp.add(0, -1, 0)).getBlock().equals(Blocks.SOUL_SAND)) { | ||
|
||
IFFakePlayer fakePlayer = (IFFakePlayer) IndustrialForegoing.getFakePlayer(world, temp); | ||
ItemStack stack = getDefaultOrFind(i, top, new ItemStack(Items.WITHER_SKELETON_SKULL)); | ||
if (fakePlayer.placeBlock(this.world, temp, stack)) { | ||
power += 1 / 7f; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return new WorkAction(1, power > 0 ? WitherBuilderConfig.powerPerOperation : 0); | ||
} | ||
|
||
@Override | ||
public VoxelShape getWorkingArea() { | ||
|
||
return new RangeManager(this.pos, this.getFacingDirection(), RangeManager.RangeType.TOP_UP) { | ||
@Override | ||
public AxisAlignedBB getBox() { | ||
if (getFacingDirection() == Direction.EAST || getFacingDirection() == Direction.WEST) { | ||
return super.getBox().offset(new BlockPos(0, 1, 0)).grow(0, 1, 1); | ||
} else { | ||
return super.getBox().offset(new BlockPos(0, 1, 0)).grow(1, 1, 0); | ||
} | ||
} | ||
}.get(0); | ||
|
||
} | ||
|
||
@Nonnull | ||
@Override | ||
public WitherBuilderTile getSelf() { | ||
return this; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
protected EnergyStorageComponent<WitherBuilderTile> createEnergyStorage() { | ||
return new EnergyStorageComponent<>(WitherBuilderConfig.maxStoredPower, 10, 20); | ||
} | ||
|
||
@Override | ||
public int getMaxProgress() { | ||
return WitherBuilderConfig.maxProgress; | ||
} | ||
|
||
|
||
public ItemStack getDefaultOrFind(int i, ItemStackHandler handler, ItemStack filter) { | ||
if (handler.getStackInSlot(i).isItemEqual(filter)) return handler.getStackInSlot(i); | ||
for (ItemStackHandler h : new ItemStackHandler[] {top, middle, bottom}) { | ||
for (int s = 0; s < h.getSlots(); ++s) { | ||
if (h.getStackInSlot(s).isItemEqual(filter)) return h.getStackInSlot(s); | ||
} | ||
} | ||
return ItemStack.EMPTY; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
.../java/com/buuz135/industrial/config/machine/agriculturehusbandry/WitherBuilderConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.buuz135.industrial.config.machine.agriculturehusbandry; | ||
|
||
import com.buuz135.industrial.config.MachineAgricultureHusbandryConfig; | ||
import com.hrznstudio.titanium.annotation.config.ConfigFile; | ||
import com.hrznstudio.titanium.annotation.config.ConfigVal; | ||
|
||
@ConfigFile.Child(MachineAgricultureHusbandryConfig.class) | ||
public class WitherBuilderConfig { | ||
|
||
@ConfigVal(comment = "Cooldown Time in Ticks [20 Ticks per Second] - Default: [40 (5s)]") | ||
public static int maxProgress = 40; | ||
|
||
@ConfigVal(comment = "Amount of Power Consumed per Operation - Default: [500FE]") | ||
public static int powerPerOperation = 20000; | ||
|
||
@ConfigVal(comment = "Max Stored Power [FE] - Default: [70000 FE]") | ||
public static int maxStoredPower = 70000; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...lforegoing/patchouli_books/industrial_foregoing/en_us/entries/agr_hus/wither_builder.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Wither Builder", | ||
"icon": "industrialforegoing:wither_builder", | ||
"category": "agriculture_husbandry", | ||
"read_by_default": true, | ||
"pages": [ | ||
{ | ||
"type": "text", | ||
"text": "A machine used to spawn withers. When provided with power, $(6)3 Wither Skulls$() and $(6)4 soulsand$(), it will completely build the wither spawning structure in the working area." | ||
}, | ||
{ | ||
"type": "crafting", | ||
"recipe": "industrialforegoing:wither_builder" | ||
} | ||
] | ||
} |