Block Placer: Measure circumventing external placement prevention.
This commit is contained in:
parent
eaac51b9ff
commit
71b8a50278
4 changed files with 15 additions and 5 deletions
|
@ -5,4 +5,4 @@ version_minecraft=1.16.4
|
||||||
version_forge_minecraft=1.16.4-35.1.10
|
version_forge_minecraft=1.16.4-35.1.10
|
||||||
version_fml_mappings=20201028-1.16.3
|
version_fml_mappings=20201028-1.16.3
|
||||||
version_jei=1.16.4:7.6.1.63
|
version_jei=1.16.4:7.6.1.63
|
||||||
version_engineersdecor=1.1.14-b1
|
version_engineersdecor=1.1.14-b2
|
||||||
|
|
|
@ -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.16.4": {
|
"1.16.4": {
|
||||||
|
"1.1.14-b2": "[F] Block Placer: Attempt circumventing external placement prevention.",
|
||||||
"1.1.14-b1": "[F] Fixed Fluid Barrel container item definition (issue #178, thx Wormbo).",
|
"1.1.14-b1": "[F] Fixed Fluid Barrel container item definition (issue #178, thx Wormbo).",
|
||||||
"1.1.13": "[R] Release build v1.1.13.\n[A] Added debug logging feature.",
|
"1.1.13": "[R] Release build v1.1.13.\n[A] Added debug logging feature.",
|
||||||
"1.1.13-b2": "[F] Fixed explosion resistance values for standard blocks.\n[F] Sandstone Ornated Clinker loot table fixed (ty czbuendel, Valen).",
|
"1.1.13-b2": "[F] Fixed explosion resistance values for standard blocks.\n[F] Sandstone Ornated Clinker loot table fixed (ty czbuendel, Valen).",
|
||||||
|
@ -37,6 +38,6 @@
|
||||||
},
|
},
|
||||||
"promos": {
|
"promos": {
|
||||||
"1.16.4-recommended": "1.1.13",
|
"1.16.4-recommended": "1.1.13",
|
||||||
"1.16.4-latest": "1.1.14-b1"
|
"1.16.4-latest": "1.1.14-b2"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.16.x.
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
- v1.1.14-b2 [F] Block Placer: Attempt circumventing external placement prevention.
|
||||||
|
|
||||||
- v1.1.14-b1 [F] Fixed Fluid Barrel container item definition (issue #178, thx Wormbo).
|
- v1.1.14-b1 [F] Fixed Fluid Barrel container item definition (issue #178, thx Wormbo).
|
||||||
|
|
||||||
- v1.1.13 [R] Release build v1.1.13.
|
- v1.1.13 [R] Release build v1.1.13.
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
package wile.engineersdecor.blocks;
|
package wile.engineersdecor.blocks;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.inventory.container.ClickType;
|
import net.minecraft.inventory.container.ClickType;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
@ -50,7 +51,6 @@ import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.fml.network.NetworkHooks;
|
import net.minecraftforge.fml.network.NetworkHooks;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import wile.engineersdecor.libmc.detail.TooltipDisplay;
|
import wile.engineersdecor.libmc.detail.TooltipDisplay;
|
||||||
import wile.engineersdecor.libmc.detail.TooltipDisplay.TipRange;
|
import wile.engineersdecor.libmc.detail.TooltipDisplay.TipRange;
|
||||||
import wile.engineersdecor.libmc.client.ContainerGui;
|
import wile.engineersdecor.libmc.client.ContainerGui;
|
||||||
|
@ -537,11 +537,18 @@ public class EdPlacer
|
||||||
placement_stack.setCount(1);
|
placement_stack.setCount(1);
|
||||||
ItemStack held = placer.getHeldItem(Hand.MAIN_HAND);
|
ItemStack held = placer.getHeldItem(Hand.MAIN_HAND);
|
||||||
placer.setHeldItem(Hand.MAIN_HAND, placement_stack);
|
placer.setHeldItem(Hand.MAIN_HAND, placement_stack);
|
||||||
use_context = new BlockItemUseContext(new ItemUseContext(placer, Hand.MAIN_HAND, new BlockRayTraceResult(new Vector3d(0.5,0,0.5), Direction.DOWN, placement_pos, false)));
|
List<Direction> directions = new ArrayList<>(Arrays.asList(Direction.UP, facing.getOpposite()));
|
||||||
|
for(Direction d:Direction.values()) if(!directions.contains(d)) directions.add(d);
|
||||||
|
for(Direction d:directions) {
|
||||||
|
Vector3d v = Vector3d.copyCentered(placement_pos).subtract(Vector3d.copy(d.getDirectionVec()));
|
||||||
|
use_context = new BlockItemUseContext(new ItemUseContext(placer, Hand.MAIN_HAND, new BlockRayTraceResult(v, d, placement_pos, false)));
|
||||||
|
if(block.getStateForPlacement(use_context) == null) use_context = null;
|
||||||
|
if(use_context!=null) break;
|
||||||
|
}
|
||||||
placer.setHeldItem(Hand.MAIN_HAND, held);
|
placer.setHeldItem(Hand.MAIN_HAND, held);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final BlockState placement_state = (use_context==null) ? (block.getDefaultState()) : (block.getStateForPlacement(use_context));
|
BlockState placement_state = (use_context==null) ? (block.getDefaultState()) : (block.getStateForPlacement(use_context));
|
||||||
if(placement_state == null) {
|
if(placement_state == null) {
|
||||||
Auxiliaries.logDebug("Placer spit: No valid placement state for item " + item.getRegistryName().toString());
|
Auxiliaries.logDebug("Placer spit: No valid placement state for item " + item.getRegistryName().toString());
|
||||||
return spit_out(facing);
|
return spit_out(facing);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue