-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: move electrotine generator to PR Core
- Loading branch information
Showing
34 changed files
with
752 additions
and
473 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
src/core/generated/assets/projectred-core/blockstates/electrotine_generator.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,64 @@ | ||
{ | ||
"variants": { | ||
"charged=false,rotation=0,working=false": { | ||
"model": "projectred-core:block/electrotine_generator" | ||
}, | ||
"charged=true,rotation=0,working=false": { | ||
"model": "projectred-core:block/electrotine_generator_state1" | ||
}, | ||
"charged=false,rotation=1,working=false": { | ||
"model": "projectred-core:block/electrotine_generator", | ||
"y": 90 | ||
}, | ||
"charged=true,rotation=1,working=false": { | ||
"model": "projectred-core:block/electrotine_generator_state1", | ||
"y": 90 | ||
}, | ||
"charged=false,rotation=2,working=false": { | ||
"model": "projectred-core:block/electrotine_generator", | ||
"y": 180 | ||
}, | ||
"charged=true,rotation=2,working=false": { | ||
"model": "projectred-core:block/electrotine_generator_state1", | ||
"y": 180 | ||
}, | ||
"charged=false,rotation=3,working=false": { | ||
"model": "projectred-core:block/electrotine_generator", | ||
"y": 270 | ||
}, | ||
"charged=true,rotation=3,working=false": { | ||
"model": "projectred-core:block/electrotine_generator_state1", | ||
"y": 270 | ||
}, | ||
"charged=false,rotation=0,working=true": { | ||
"model": "projectred-core:block/electrotine_generator_state2" | ||
}, | ||
"charged=true,rotation=0,working=true": { | ||
"model": "projectred-core:block/electrotine_generator_state3" | ||
}, | ||
"charged=false,rotation=1,working=true": { | ||
"model": "projectred-core:block/electrotine_generator_state2", | ||
"y": 90 | ||
}, | ||
"charged=true,rotation=1,working=true": { | ||
"model": "projectred-core:block/electrotine_generator_state3", | ||
"y": 90 | ||
}, | ||
"charged=false,rotation=2,working=true": { | ||
"model": "projectred-core:block/electrotine_generator_state2", | ||
"y": 180 | ||
}, | ||
"charged=true,rotation=2,working=true": { | ||
"model": "projectred-core:block/electrotine_generator_state3", | ||
"y": 180 | ||
}, | ||
"charged=false,rotation=3,working=true": { | ||
"model": "projectred-core:block/electrotine_generator_state2", | ||
"y": 270 | ||
}, | ||
"charged=true,rotation=3,working=true": { | ||
"model": "projectred-core:block/electrotine_generator_state3", | ||
"y": 270 | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/core/generated/assets/projectred-core/models/block/electrotine_generator.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,9 @@ | ||
{ | ||
"parent": "minecraft:block/orientable_with_bottom", | ||
"textures": { | ||
"side": "projectred-core:block/electrotine_generator_side", | ||
"front": "projectred-core:block/electrotine_generator_front_0", | ||
"bottom": "projectred-core:block/electrotine_generator_bottom", | ||
"top": "projectred-core:block/electrotine_generator_top" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/core/generated/assets/projectred-core/models/block/electrotine_generator_state1.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,9 @@ | ||
{ | ||
"parent": "minecraft:block/orientable_with_bottom", | ||
"textures": { | ||
"side": "projectred-core:block/electrotine_generator_side", | ||
"front": "projectred-core:block/electrotine_generator_front_1", | ||
"bottom": "projectred-core:block/electrotine_generator_bottom", | ||
"top": "projectred-core:block/electrotine_generator_top" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/core/generated/assets/projectred-core/models/block/electrotine_generator_state2.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,9 @@ | ||
{ | ||
"parent": "minecraft:block/orientable_with_bottom", | ||
"textures": { | ||
"side": "projectred-core:block/electrotine_generator_side", | ||
"front": "projectred-core:block/electrotine_generator_front_2", | ||
"bottom": "projectred-core:block/electrotine_generator_bottom", | ||
"top": "projectred-core:block/electrotine_generator_top" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/core/generated/assets/projectred-core/models/block/electrotine_generator_state3.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,9 @@ | ||
{ | ||
"parent": "minecraft:block/orientable_with_bottom", | ||
"textures": { | ||
"side": "projectred-core:block/electrotine_generator_side", | ||
"front": "projectred-core:block/electrotine_generator_front_3", | ||
"bottom": "projectred-core:block/electrotine_generator_bottom", | ||
"top": "projectred-core:block/electrotine_generator_top" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/core/generated/assets/projectred-core/models/item/electrotine_generator.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": "projectred-core:block/electrotine_generator" | ||
} |
25 changes: 25 additions & 0 deletions
25
src/core/generated/data/projectred-core/recipes/electrotine_generator.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,25 @@ | ||
{ | ||
"type": "minecraft:crafting_shaped", | ||
"result": { | ||
"item": "projectred-core:electrotine_generator" | ||
}, | ||
"pattern": [ | ||
"bbb", | ||
"bdb", | ||
"cec" | ||
], | ||
"key": { | ||
"c": { | ||
"item": "minecraft:clay" | ||
}, | ||
"e": { | ||
"tag": "forge:ingots/electrotine_alloy" | ||
}, | ||
"d": { | ||
"tag": "forge:dusts/electrotine" | ||
}, | ||
"b": { | ||
"item": "minecraft:bricks" | ||
} | ||
} | ||
} |
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
Binary file added
BIN
+18.7 KB
...esources/assets/projectred-core/textures/block/electrotine_generator_bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.4 KB
...sources/assets/projectred-core/textures/block/electrotine_generator_front_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.4 KB
...sources/assets/projectred-core/textures/block/electrotine_generator_front_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.4 KB
...sources/assets/projectred-core/textures/block/electrotine_generator_front_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.5 KB
...sources/assets/projectred-core/textures/block/electrotine_generator_front_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.4 KB
.../resources/assets/projectred-core/textures/block/electrotine_generator_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.6 KB
...e/resources/assets/projectred-core/textures/block/electrotine_generator_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.1 KB
src/core/resources/assets/projectred-core/textures/gui/electrotine_generator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions
43
src/core/scala/mrtjp/projectred/core/block/ElectrotineGeneratorBlock.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,43 @@ | ||
package mrtjp.projectred.core.block; | ||
|
||
import codechicken.lib.vec.Rotation; | ||
import mrtjp.projectred.core.tile.ElectrotineGeneratorTile; | ||
import net.minecraft.block.AbstractBlock; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.item.BlockItemUseContext; | ||
import net.minecraft.state.StateContainer; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.world.IBlockReader; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public class ElectrotineGeneratorBlock extends ProjectRedBlock { | ||
|
||
public ElectrotineGeneratorBlock() { | ||
super(AbstractBlock.Properties.of(Material.STONE)); | ||
} | ||
|
||
@Override | ||
protected TileEntity createTileEntityInstance(BlockState state, IBlockReader world) { | ||
return new ElectrotineGeneratorTile(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public BlockState getStateForPlacement(BlockItemUseContext context) { | ||
int r = Rotation.rotationTo(0, context.getHorizontalDirection().ordinal()); | ||
return this.defaultBlockState() | ||
.setValue(ROTATION, r) | ||
.setValue(CHARGED, false) | ||
.setValue(WORKING, false); | ||
} | ||
|
||
@Override | ||
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) { | ||
builder.add(ROTATION); | ||
builder.add(CHARGED); | ||
builder.add(WORKING); | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
src/core/scala/mrtjp/projectred/core/block/ProjectRedBlock.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,86 @@ | ||
package mrtjp.projectred.core.block; | ||
|
||
import mrtjp.projectred.core.tile.IBlockEventTile; | ||
import net.minecraft.block.AbstractBlock; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.state.BooleanProperty; | ||
import net.minecraft.state.IntegerProperty; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.ActionResultType; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.BlockRayTraceResult; | ||
import net.minecraft.world.IBlockReader; | ||
import net.minecraft.world.IWorldReader; | ||
import net.minecraft.world.World; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public abstract class ProjectRedBlock extends Block { | ||
|
||
public static final IntegerProperty SIDE = IntegerProperty.create("side", 0, 5); | ||
public static final IntegerProperty ROTATION = IntegerProperty.create("rotation", 0, 3); | ||
public static final BooleanProperty CHARGED = BooleanProperty.create("charged"); | ||
public static final BooleanProperty WORKING = BooleanProperty.create("working"); | ||
|
||
public ProjectRedBlock(AbstractBlock.Properties properties) { | ||
super(properties); | ||
} | ||
|
||
protected abstract TileEntity createTileEntityInstance(BlockState state, IBlockReader world); | ||
|
||
@Override | ||
public boolean hasTileEntity(BlockState state) { | ||
return true; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public TileEntity createTileEntity(BlockState state, IBlockReader world) { | ||
TileEntity tile = createTileEntityInstance(state, world); | ||
if (tile instanceof IBlockEventTile) ((IBlockEventTile) tile).loadBlockState(state); | ||
return tile; | ||
} | ||
|
||
@Override | ||
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos neighbor, boolean isMoving) { | ||
TileEntity tile = world.getBlockEntity(pos); | ||
if (tile instanceof IBlockEventTile) ((IBlockEventTile) tile).onNeighborBlockChanged(neighbor); | ||
} | ||
|
||
@Override | ||
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) { | ||
TileEntity tile = world.getBlockEntity(pos); | ||
if (tile instanceof IBlockEventTile) ((IBlockEventTile) tile).onNeighborTileChanged(neighbor); | ||
} | ||
|
||
@Override | ||
public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { | ||
TileEntity tile = world.getBlockEntity(pos); | ||
if (tile instanceof IBlockEventTile) return ((IBlockEventTile) tile).onBlockActivated(player, hand, hit); | ||
return ActionResultType.FAIL; //TODO pass? | ||
} | ||
|
||
@Override | ||
public void onRemove(BlockState oldState, World world, BlockPos pos, BlockState newState, boolean isMoving) { | ||
TileEntity tile = world.getBlockEntity(pos); | ||
if (tile instanceof IBlockEventTile) { | ||
if (oldState.is(newState.getBlock())) { | ||
((IBlockEventTile) tile).onBlockStateReplaced(newState); | ||
} else { | ||
((IBlockEventTile) tile).onBlockRemoved(); | ||
} | ||
} | ||
super.onRemove(oldState, world, pos, newState, isMoving); // Removes tile if no longer valid for new state | ||
} | ||
|
||
@Override | ||
public void setPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity player, ItemStack stack) { | ||
TileEntity tile = world.getBlockEntity(pos); | ||
if (tile instanceof IBlockEventTile) ((IBlockEventTile) tile).onBlockPlaced(player, stack); | ||
} | ||
} |
Oops, something went wrong.