mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Froptics
- Frogports can now be equipped with goggles - Fixed frogports playing the open animation twice when not catching a package successfully
This commit is contained in:
parent
48e8723fcd
commit
8dd17cf7c2
6 changed files with 185 additions and 3 deletions
|
@ -130,6 +130,7 @@ public class AllPartialModels {
|
|||
CHAIN_CONVEYOR_SHAFT = block("chain_conveyor/shaft"),
|
||||
|
||||
FROGPORT_BODY = block("package_frogport/body"), FROGPORT_HEAD = block("package_frogport/head"),
|
||||
FROGPORT_HEAD_GOGGLES = block("package_frogport/head_goggles"),
|
||||
FROGPORT_TONGUE = block("package_frogport/tongue"),
|
||||
POSTBOX_FLAG = block("package_postbox/flag"),
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.packagePort.frogport;
|
|||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.content.logistics.box.PackageItem;
|
||||
import com.simibubi.create.content.logistics.box.PackageStyles;
|
||||
|
@ -27,6 +28,8 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
@ -45,6 +48,7 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
public LerpedFloat animationProgress;
|
||||
public LerpedFloat anticipationProgress;
|
||||
public boolean currentlyDepositing;
|
||||
public boolean goggles;
|
||||
|
||||
public boolean sendAnticipate;
|
||||
|
||||
|
@ -66,6 +70,7 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
manualOpenAnimationProgress = LerpedFloat.linear()
|
||||
.startWithValue(0)
|
||||
.chase(0, 0.35, Chaser.LINEAR);
|
||||
goggles = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,7 +132,7 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
}
|
||||
|
||||
if (anticipationProgress.getValue() == 1)
|
||||
anticipationProgress.updateChaseTarget(0);
|
||||
anticipationProgress.startWithValue(0);
|
||||
|
||||
manualOpenAnimationProgress.updateChaseTarget(openTracker.openCount > 0 ? 1 : 0);
|
||||
boolean wasOpen = manualOpenAnimationProgress.getValue() > 0;
|
||||
|
@ -311,6 +316,8 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
}
|
||||
if (failedLastExport)
|
||||
NBTHelper.putMarker(tag, "FailedLastExport");
|
||||
if (goggles)
|
||||
NBTHelper.putMarker(tag, "Goggles");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -318,6 +325,7 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
super.read(tag, clientPacket);
|
||||
passiveYaw = tag.getFloat("PlacedYaw");
|
||||
failedLastExport = tag.getBoolean("FailedLastExport");
|
||||
goggles = tag.getBoolean("Goggles");
|
||||
if (!clientPacket)
|
||||
animatedPackage = null;
|
||||
if (tag.contains("AnimatedPackage")) {
|
||||
|
@ -351,4 +359,22 @@ public class FrogportBlockEntity extends PackagePortBlockEntity implements IHave
|
|||
sounds.open(level, worldPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult use(Player player) {
|
||||
if (player == null)
|
||||
return InteractionResult.PASS;
|
||||
|
||||
ItemStack mainHandItem = player.getMainHandItem();
|
||||
if (!goggles && AllItems.GOGGLES.isIn(mainHandItem)) {
|
||||
goggles = true;
|
||||
if (!level.isClientSide()) {
|
||||
notifyUpdate();
|
||||
level.playSound(null, worldPosition, SoundEvents.ARMOR_EQUIP_GOLD, SoundSource.BLOCKS, 0.5f, 1.0f);
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return super.use(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public class FrogportRenderer extends SmartBlockEntityRenderer<FrogportBlockEnti
|
|||
.overlay(overlay)
|
||||
.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
|
||||
|
||||
SuperByteBuffer head = CachedBuffers.partial(AllPartialModels.FROGPORT_HEAD, blockEntity.getBlockState());
|
||||
SuperByteBuffer head = CachedBuffers.partial(blockEntity.goggles ? AllPartialModels.FROGPORT_HEAD_GOGGLES : AllPartialModels.FROGPORT_HEAD, blockEntity.getBlockState());
|
||||
|
||||
head.center()
|
||||
.rotateYDegrees(yaw)
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
|||
|
||||
public class FrogportVisual extends AbstractBlockEntityVisual<FrogportBlockEntity> implements SimpleDynamicVisual {
|
||||
private final TransformedInstance body;
|
||||
private final TransformedInstance head;
|
||||
private TransformedInstance head;
|
||||
private final TransformedInstance tongue;
|
||||
private final TransformedInstance rig;
|
||||
private final TransformedInstance box;
|
||||
|
@ -33,6 +33,7 @@ public class FrogportVisual extends AbstractBlockEntityVisual<FrogportBlockEntit
|
|||
private float lastHeadPitch = Float.NaN;
|
||||
private float lastTonguePitch = Float.NaN;
|
||||
private float lastTongueLength = Float.NaN;
|
||||
private boolean lastGoggles = false;
|
||||
|
||||
public FrogportVisual(VisualizationContext ctx, FrogportBlockEntity blockEntity, float partialTick) {
|
||||
super(ctx, blockEntity, partialTick);
|
||||
|
@ -69,6 +70,8 @@ public class FrogportVisual extends AbstractBlockEntityVisual<FrogportBlockEntit
|
|||
}
|
||||
|
||||
private void animate(float partialTicks) {
|
||||
updateGoggles();
|
||||
|
||||
float yaw = blockEntity.getYaw();
|
||||
|
||||
float headPitch = 80;
|
||||
|
@ -172,6 +175,28 @@ public class FrogportVisual extends AbstractBlockEntityVisual<FrogportBlockEntit
|
|||
}
|
||||
}
|
||||
|
||||
public void updateGoggles() {
|
||||
if (blockEntity.goggles && !lastGoggles) {
|
||||
head.delete();
|
||||
head = instancerProvider()
|
||||
.instancer(InstanceTypes.TRANSFORMED, Models.partial(AllPartialModels.FROGPORT_HEAD_GOGGLES))
|
||||
.createInstance();
|
||||
lastHeadPitch = -1;
|
||||
updateLight(0);
|
||||
lastGoggles = true;
|
||||
}
|
||||
|
||||
if (!blockEntity.goggles && lastGoggles) {
|
||||
head.delete();
|
||||
head = instancerProvider()
|
||||
.instancer(InstanceTypes.TRANSFORMED, Models.partial(AllPartialModels.FROGPORT_HEAD))
|
||||
.createInstance();
|
||||
lastHeadPitch = -1;
|
||||
updateLight(0);
|
||||
lastGoggles = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPackage(Vec3 diff, float scale, float itemDistance) {
|
||||
if (blockEntity.animatedPackage == null || scale < 0.45) {
|
||||
rig.handle()
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "create:block/port2",
|
||||
"1": "create:block/port",
|
||||
"2": "create:block/froggles",
|
||||
"particle": "create:block/port2"
|
||||
},
|
||||
"render_type": "minecraft:cutout",
|
||||
"elements": [
|
||||
{
|
||||
"from": [2, 9, 2],
|
||||
"to": [14, 14, 14],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 9, 11]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 6, 2.5], "texture": "#1"},
|
||||
"east": {"uv": [12, 0, 6, 2.5], "texture": "#1"},
|
||||
"south": {"uv": [6, 10, 12, 12.5], "texture": "#1"},
|
||||
"west": {"uv": [6, 0, 12, 2.5], "texture": "#1"},
|
||||
"up": {"uv": [0, 10, 6, 16], "rotation": 180, "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [14, 9, 2],
|
||||
"to": [2, 14, 14],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [20, 10, 11]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 6, 2.5], "texture": "#1"},
|
||||
"east": {"uv": [12, 0, 6, 2.5], "texture": "#1"},
|
||||
"south": {"uv": [6, 10, 12, 12.5], "texture": "#1"},
|
||||
"west": {"uv": [6, 0, 12, 2.5], "texture": "#1"},
|
||||
"up": {"uv": [0, 10, 6, 16], "rotation": 180, "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [2, 10, 2],
|
||||
"to": [14, 10, 11],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 10, 11]},
|
||||
"faces": {
|
||||
"down": {"uv": [0, 0, 6, 4.5], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [1.8, 11, 1.8],
|
||||
"to": [5, 14.2, 5],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [2, 11, 2]},
|
||||
"faces": {
|
||||
"north": {"uv": [4.5, 0, 6, 1.5], "texture": "#1"},
|
||||
"east": {"uv": [8, 5.5, 9.5, 7], "texture": "#1"},
|
||||
"south": {"uv": [8, 5.5, 9.5, 7], "texture": "#1"},
|
||||
"west": {"uv": [6, 0, 7.5, 1.5], "texture": "#1"},
|
||||
"up": {"uv": [4.5, 14.5, 6, 16], "rotation": 180, "texture": "#1"},
|
||||
"down": {"uv": [8, 5.5, 9.5, 7], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [11, 11, 1.8],
|
||||
"to": [14.2, 14.2, 5],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [11, 11, 2]},
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 4.5, 1.5], "texture": "#1"},
|
||||
"east": {"uv": [7.5, 0, 6, 1.5], "texture": "#1"},
|
||||
"south": {"uv": [8, 5.5, 9.5, 7], "texture": "#1"},
|
||||
"west": {"uv": [8, 5.5, 9.5, 7], "texture": "#1"},
|
||||
"up": {"uv": [4.5, 14.5, 6, 16], "rotation": 270, "texture": "#1"},
|
||||
"down": {"uv": [8, 5.5, 9.5, 7], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "lense ext",
|
||||
"from": [1.6, 10, 1.6],
|
||||
"to": [14.4, 14.4, 6],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [2, 10, 2]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 12, 12, 16], "texture": "#2"},
|
||||
"east": {"uv": [16, 12, 12, 16], "texture": "#2"},
|
||||
"west": {"uv": [12, 12, 16, 16], "texture": "#2"},
|
||||
"up": {"uv": [12, 12, 0, 8], "texture": "#2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "lense int",
|
||||
"from": [14.4, 10, 1.6],
|
||||
"to": [1.6, 14.4, 6],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [15, 10, 2]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 12, 12, 16], "texture": "#2"},
|
||||
"east": {"uv": [16, 12, 12, 16], "texture": "#2"},
|
||||
"west": {"uv": [12, 12, 16, 16], "texture": "#2"},
|
||||
"up": {"uv": [12, 12, 0, 8], "texture": "#2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "strap ext",
|
||||
"from": [1.6, 10, 6],
|
||||
"to": [14.4, 14.4, 14.4],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [2, 10, 6]},
|
||||
"faces": {
|
||||
"east": {"uv": [8, 0, 0, 4], "texture": "#2"},
|
||||
"south": {"uv": [0, 4, 12, 8], "texture": "#2"},
|
||||
"west": {"uv": [0, 0, 8, 4], "texture": "#2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "strap int",
|
||||
"from": [14.4, 10, 6],
|
||||
"to": [1.6, 14.4, 14.4],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [15, 10, 6]},
|
||||
"faces": {
|
||||
"east": {"uv": [8, 0, 0, 4], "texture": "#2"},
|
||||
"south": {"uv": [12, 4, 0, 8], "texture": "#2"},
|
||||
"west": {"uv": [0, 0, 8, 4], "texture": "#2"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"name": "port_head",
|
||||
"origin": [8, 8, 8],
|
||||
"color": 0,
|
||||
"children": [0, 1, 2, 3, 4]
|
||||
},
|
||||
{
|
||||
"name": "froggles",
|
||||
"origin": [8, 8, 8],
|
||||
"color": 0,
|
||||
"children": [5, 6, 7, 8]
|
||||
}
|
||||
]
|
||||
}
|
BIN
src/main/resources/assets/create/textures/block/froggles.png
Normal file
BIN
src/main/resources/assets/create/textures/block/froggles.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 582 B |
Loading…
Add table
Reference in a new issue