-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #683 from fixrtm/fix-picking-machine
Fix picking blocks
- Loading branch information
Showing
19 changed files
with
229 additions
and
45 deletions.
There are no files selected for viewing
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
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/anatawa12/fixRtm/rtm/block/BlockDecoration.kt
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,22 @@ | ||
/// Copyright (c) 2023 anatawa12 and other contributors | ||
/// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions | ||
/// See LICENSE at https://github.com/fixrtm/fixRTM for more details | ||
|
||
package com.anatawa12.fixRtm.rtm.block | ||
|
||
import jp.ngt.rtm.RTMItem | ||
import jp.ngt.rtm.block.tileentity.TileEntityDecoration | ||
import jp.ngt.rtm.item.ItemDecoration | ||
import net.minecraft.item.ItemStack | ||
import net.minecraft.util.math.BlockPos | ||
import net.minecraft.world.World | ||
|
||
fun getPickBlock(world: World, pos: BlockPos): ItemStack { | ||
val tileEntity = world.getTileEntity(pos) | ||
if (tileEntity is TileEntityDecoration) { | ||
val itemStack = ItemStack(RTMItem.decoration_block) | ||
ItemDecoration.setModel(itemStack, tileEntity.modelName) | ||
return itemStack | ||
} | ||
return ItemStack.EMPTY | ||
} |
33 changes: 0 additions & 33 deletions
33
src/main/java/com/anatawa12/fixRtm/rtm/block/BlockMachineBase.kt
This file was deleted.
Oops, something went wrong.
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
14 changes: 14 additions & 0 deletions
14
src/main/rtm-patches/jp/ngt/rtm/block/BlockCrossingGate.java.patch
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,14 @@ | ||
--- a/jp/ngt/rtm/block/BlockCrossingGate.java | ||
+++ b/jp/ngt/rtm/block/BlockCrossingGate.java | ||
@@ -46,6 +46,11 @@ | ||
|
||
private void checkPower(World world, int x, int y, int z) { | ||
TileEntityCrossingGate tileentitycrossinggate = (TileEntityCrossingGate)BlockUtil.getTileEntity(world, x, y, z); | ||
tileentitycrossinggate.isGettingPower = world.getRedstonePowerFromNeighbors(new BlockPos(x, y, z)) > 0; | ||
} | ||
+ | ||
+ @Override | ||
+ public ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { | ||
+ return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.CROSSING); | ||
+ } | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/rtm-patches/jp/ngt/rtm/block/BlockDecoration.java.patch
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,13 @@ | ||
--- a/jp/ngt/rtm/block/BlockDecoration.java | ||
+++ b/jp/ngt/rtm/block/BlockDecoration.java | ||
@@ -12,6 +12,10 @@ | ||
} | ||
|
||
public TileEntity createNewTileEntity(World world, int meta) { | ||
return new TileEntityDecoration(); | ||
} | ||
+ | ||
+ public net.minecraft.item.ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { | ||
+ return com.anatawa12.fixRtm.rtm.block.BlockDecorationKt.getPickBlock(world, pos); | ||
+ } | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/rtm-patches/jp/ngt/rtm/block/BlockFlag.java.patch
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,14 @@ | ||
--- a/jp/ngt/rtm/block/BlockFlag.java | ||
+++ b/jp/ngt/rtm/block/BlockFlag.java | ||
@@ -31,6 +31,11 @@ | ||
entityplayer.openGui(RTMCore.instance, RTMCore.guiIdSelectTileEntityTexture, holder.getWorld(), i, j, k); | ||
} | ||
|
||
return true; | ||
} | ||
+ | ||
+ @Override | ||
+ public net.minecraft.item.ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, EntityPlayer player) { | ||
+ return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.FLAG); | ||
+ } | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/rtm-patches/jp/ngt/rtm/block/BlockLight.java.patch
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,14 @@ | ||
--- a/jp/ngt/rtm/block/BlockLight.java | ||
+++ b/jp/ngt/rtm/block/BlockLight.java | ||
@@ -30,6 +30,11 @@ | ||
return super.removedByPlayer(holder, willHarvest); | ||
} else { | ||
return PermissionManager.INSTANCE.hasPermission(holder.getPlayer(), "editOrnament") ? super.removedByPlayer(holder, willHarvest) : false; | ||
} | ||
} | ||
+ | ||
+ @Override | ||
+ public ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { | ||
+ return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.LIGHT); | ||
+ } | ||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/rtm-patches/jp/ngt/rtm/block/BlockMechanism.java.patch
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,14 @@ | ||
--- a/jp/ngt/rtm/block/BlockMechanism.java | ||
+++ b/jp/ngt/rtm/block/BlockMechanism.java | ||
@@ -29,6 +29,11 @@ | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
+ | ||
+ @Override | ||
+ public net.minecraft.item.ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { | ||
+ return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.MECHANISM); | ||
+ } | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/rtm-patches/jp/ngt/rtm/block/BlockPoint.java.patch
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,14 @@ | ||
--- a/jp/ngt/rtm/block/BlockPoint.java | ||
+++ b/jp/ngt/rtm/block/BlockPoint.java | ||
@@ -65,6 +65,11 @@ | ||
} | ||
|
||
public boolean canProvidePower(IBlockState state) { | ||
return true; | ||
} | ||
+ | ||
+ @Override | ||
+ public net.minecraft.item.ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { | ||
+ return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.POINT); | ||
+ } | ||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/rtm-patches/jp/ngt/rtm/block/BlockStation.java.patch
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,14 @@ | ||
--- a/jp/ngt/rtm/block/BlockStation.java | ||
+++ b/jp/ngt/rtm/block/BlockStation.java | ||
@@ -56,6 +56,11 @@ | ||
int j = pos.getY(); | ||
int k = pos.getZ(); | ||
} | ||
|
||
} | ||
+ | ||
+ @Override | ||
+ protected net.minecraft.item.ItemStack getItem(int damage) { | ||
+ return new net.minecraft.item.ItemStack(this); | ||
+ } | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/rtm-patches/jp/ngt/rtm/block/BlockTurnstile.java.patch
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,14 @@ | ||
--- a/jp/ngt/rtm/block/BlockTurnstile.java | ||
+++ b/jp/ngt/rtm/block/BlockTurnstile.java | ||
@@ -113,6 +113,11 @@ | ||
} | ||
|
||
public PathNodeType getAiPathNodeType(IBlockState state, IBlockAccess world, BlockPos pos) { | ||
return canThrough(world, pos) ? PathNodeType.OPEN : PathNodeType.BLOCKED; | ||
} | ||
+ | ||
+ @Override | ||
+ public ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { | ||
+ return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.TURNSTILE); | ||
+ } | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/rtm-patches/jp/ngt/rtm/electric/BlockSpeaker.java.patch
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,14 @@ | ||
--- a/jp/ngt/rtm/electric/BlockSpeaker.java | ||
+++ b/jp/ngt/rtm/electric/BlockSpeaker.java | ||
@@ -45,6 +45,11 @@ | ||
} | ||
|
||
public boolean canConnect(World world, int x, int y, int z) { | ||
return true; | ||
} | ||
+ | ||
+ @Override | ||
+ public ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { | ||
+ return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.SPEAKER); | ||
+ } | ||
} |
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