death.attack.train
- Fast moving trains now hurt colliding players and mobs (configurable)
This commit is contained in:
parent
48dcf583c1
commit
2f4968e15e
23 changed files with 141 additions and 33 deletions
|
@ -542,22 +542,22 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
|
|||
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
|
||||
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
|
||||
d4cdc38cd19460fd9ba866f3ad3b2e4bd014cb98 assets/create/lang/en_ud.json
|
||||
4ed8b6910b0787d9bfa3b1a3f9e891d67b9b8af6 assets/create/lang/en_us.json
|
||||
780146d410f9416463587eb29c5ddd3ceda3df6b assets/create/lang/unfinished/de_de.json
|
||||
43e74873dff9c74b965d71a096390f1300d96d75 assets/create/lang/unfinished/es_cl.json
|
||||
caabbb6bbfed8b399ba71497a6ccf7de7b196264 assets/create/lang/unfinished/es_es.json
|
||||
c66402dc057027d4a1a972830ae8f13812f70726 assets/create/lang/unfinished/fr_fr.json
|
||||
367ceab5da165c8d52842337300a55f2238d8d93 assets/create/lang/unfinished/it_it.json
|
||||
1371fe6852059b897b364de723663ba652b7690f assets/create/lang/unfinished/ja_jp.json
|
||||
9ffb5cd3e5298a6b6d3d8eafb7b6be708390e375 assets/create/lang/unfinished/ko_kr.json
|
||||
ddb5b7d7d8b8d798caca64ff4c26c28f223f8771 assets/create/lang/unfinished/nl_nl.json
|
||||
b1eb44b1d043fd64b6d9d0455da939af893526c5 assets/create/lang/unfinished/pl_pl.json
|
||||
695732ec36cf7b39e1dcf467a58e9b438bbf52d5 assets/create/lang/unfinished/pt_br.json
|
||||
1b1dbd8df62df4424b6d576ad1ce8f0986829d4e assets/create/lang/unfinished/pt_pt.json
|
||||
9a92874e612ddc59a7420bf401d719f792ac9467 assets/create/lang/unfinished/ro_ro.json
|
||||
f0b799b93634d61d7799808d137003ab8c67c2c4 assets/create/lang/unfinished/ru_ru.json
|
||||
b29afaece334e84972afc027f00b53e6d2501ebf assets/create/lang/unfinished/zh_cn.json
|
||||
aa016cb464bd32865ef05034ad3bf317c14d7cdf assets/create/lang/unfinished/zh_tw.json
|
||||
4111057d7de305bffb7133afbaea0aea45f7ce79 assets/create/lang/en_us.json
|
||||
818f913210c5d3e21189a092759b4927ee032564 assets/create/lang/unfinished/de_de.json
|
||||
23cb78876cf0892edc3b5b11d772d27969773b1c assets/create/lang/unfinished/es_cl.json
|
||||
8d15c0a8f7d996667c6e38b2f84ed88542344929 assets/create/lang/unfinished/es_es.json
|
||||
17ae724dfe4ca23b2e39157a9361b38094445e64 assets/create/lang/unfinished/fr_fr.json
|
||||
c4a51cbb988e18ca1379eeb7256b70743df49bc2 assets/create/lang/unfinished/it_it.json
|
||||
04d821a172dabdecc6d20eb44f409e9409e5066a assets/create/lang/unfinished/ja_jp.json
|
||||
816a0b1dbc98a5ebdc013a19c1827dcff0f60461 assets/create/lang/unfinished/ko_kr.json
|
||||
5ee0cf289312ad91cae5d3bf8e50b1aacb7e6508 assets/create/lang/unfinished/nl_nl.json
|
||||
f35b613037e9d99dbeee151c1835222c26ce7b74 assets/create/lang/unfinished/pl_pl.json
|
||||
436da9779b9e9cb943f88999fd77dad71f80779c assets/create/lang/unfinished/pt_br.json
|
||||
80778b15cf9c92fd1baac3577d791ef7254aa080 assets/create/lang/unfinished/pt_pt.json
|
||||
9175aa77343034a6cb50203d7ed26513ea1938b0 assets/create/lang/unfinished/ro_ro.json
|
||||
95f7979d258cd2ddfc4166cae526b3571d17c630 assets/create/lang/unfinished/ru_ru.json
|
||||
e0e311ce6878a910e9a14eef36c9d5faa6ff780b assets/create/lang/unfinished/zh_cn.json
|
||||
bbdeb59c2b294eb6ef98aa75b610795f75a4dd7b assets/create/lang/unfinished/zh_tw.json
|
||||
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
|
||||
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
|
||||
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json
|
||||
|
|
|
@ -816,6 +816,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s was shot by %2$s using %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.run_over": "%1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "a rogue Deployer",
|
||||
"create.block.cart_assembler.invalid": "Place your Cart Assembler on a rail block",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 1528",
|
||||
"_": "Missing Localizations: 1529",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "UNLOCALIZED: %1$s was shot by %2$s using %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s wurde durch eine falsche Kuckucksuhr gesprengt",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "UNLOCALIZED: %1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "einem Finger",
|
||||
"create.block.cart_assembler.invalid": "Platziere deinen Lorenmonteur auf einer Schiene.",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 550",
|
||||
"_": "Missing Localizations: 551",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s fué disparado por %2$s usando %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s fué reventado por el reloj cu-cú manipulado",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s fué reventado por el reloj cu-cú manipulado",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "Un Desplegador pillo",
|
||||
"create.block.cart_assembler.invalid": "Coloca tu ensamblador de Vagonetas en un bloque de rieles",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 221",
|
||||
"_": "Missing Localizations: 222",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s fue disparado por %2$s utilizando %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s fue volado por los aires por un reloj de cuco manipulado",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s fue volado por un reloj de cuco manipulado",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "Un desplegador rebelde",
|
||||
"create.block.cart_assembler.invalid": "Coloque su Ensamblador de vagonetas en un bloque de Raíles",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 1790",
|
||||
"_": "Missing Localizations: 1791",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "UNLOCALIZED: %1$s was shot by %2$s using %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s a été explosé par un coucou trafiquée",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "UNLOCALIZED: %1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "un déployeur voyou",
|
||||
"create.block.cart_assembler.invalid": "UNLOCALIZED: Place your Cart Assembler on a rail block",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 1479",
|
||||
"_": "Missing Localizations: 1480",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "UNLOCALIZED: %1$s was shot by %2$s using %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s è saltato in aria da un orologio a cucù manomesso",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "UNLOCALIZED: %1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "un disadattato",
|
||||
"create.block.cart_assembler.invalid": "Piazza il tuo assemblatore di carrelli da miniera su un binario",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 216",
|
||||
"_": "Missing Localizations: 217",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$sは%2$sの%3$sに撃た抜かれた",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$sは改造された鳩時計に爆破された",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$sは何者かによって改造された鳩時計に爆破された",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "悪いデプロイヤー",
|
||||
"create.block.cart_assembler.invalid": "トロッコアセンブラはレールの上にのみ設置できます",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 216",
|
||||
"_": "Missing Localizations: 217",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s이(가) %3$s을(를) 사용한 %2$s에게 맞아 죽었습니다.",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s이(가) 조작된 뻐꾸기 시계에 의해 폭파당했습니다",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s이(가) 조작된 뻐꾸기 시계에 의해 폭파당했습니다",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "기계 손",
|
||||
"create.block.cart_assembler.invalid": "카트 조립기를 레일 위에 설치하세요",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 2142",
|
||||
"_": "Missing Localizations: 2143",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "UNLOCALIZED: %1$s was shot by %2$s using %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "UNLOCALIZED: %1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "UNLOCALIZED: %1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "UNLOCALIZED: a rogue Deployer",
|
||||
"create.block.cart_assembler.invalid": "UNLOCALIZED: Place your Cart Assembler on a rail block",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 589",
|
||||
"_": "Missing Localizations: 590",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "Gracz %1$s został zestrzelowny przez %2$s z użyciem %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "Gracz %1$s został wysadzony w powietrze przez uszkodzony zegar z kukułką",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "Gracz %1$s został wysadzony w powietrze przez uszkodzony zegar z kukułką",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "zbuntowany aplikator",
|
||||
"create.block.cart_assembler.invalid": "Postaw monter wagoników na torze",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 1390",
|
||||
"_": "Missing Localizations: 1391",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s foi atirado por %2$s usando %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s foi explodido por relógio cuco adulterado",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s foi explodido por relógio cuco adulterado",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "UNLOCALIZED: a rogue Deployer",
|
||||
"create.block.cart_assembler.invalid": "UNLOCALIZED: Place your Cart Assembler on a rail block",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 1762",
|
||||
"_": "Missing Localizations: 1763",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s foi atirado por %2$s usando %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s foi explodido por relógio cuco adulterado",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s foi explodido por relógio cuco adulterado",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "UNLOCALIZED: a rogue Deployer",
|
||||
"create.block.cart_assembler.invalid": "UNLOCALIZED: Place your Cart Assembler on a rail block",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 217",
|
||||
"_": "Missing Localizations: 218",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s a fost împușcat de către %2$s folosind %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s a fost aruncat în aer de către un ceas cucu manipulat",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s a fost aruncat în aer de către un ceas cucu manipulat",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "un Deployer necinstit",
|
||||
"create.block.cart_assembler.invalid": "Plasează Asamblatorul tău De Vagonet pe un bloc de șină",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 594",
|
||||
"_": "Missing Localizations: 595",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s был застрелен %2$s при помощи «%3$s»",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s взорвали подделанные часы с кукушкой",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s был взорван подделанными часами с кукушкой",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "автономным активатором",
|
||||
"create.block.cart_assembler.invalid": "Поместите сборщик вагонеток на блок рельс",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 216",
|
||||
"_": "Missing Localizations: 217",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s被%2$s用%3$s射死了",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s被布谷鸟钟炸得粉身碎骨",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s被布谷鸟钟炸得粉身碎骨",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "二五仔机械手",
|
||||
"create.block.cart_assembler.invalid": "请将矿车装配器放置在铁轨上",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 608",
|
||||
"_": "Missing Localizations: 609",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -817,6 +817,7 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s 被 %2$s 用馬鈴薯大砲塞了滿肚子 %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s 被布穀鳥鐘炸得粉身碎骨",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s 被布穀鳥鐘炸得粉身碎骨",
|
||||
"death.attack.create.run_over": "UNLOCALIZED: %1$s was run over by %2$s",
|
||||
|
||||
"create.block.deployer.damage_source_name": "機械手",
|
||||
"create.block.cart_assembler.invalid": "將您的礦車裝修站放在鐵軌上",
|
||||
|
|
|
@ -17,9 +17,11 @@ import com.simibubi.create.content.contraptions.components.actors.BlockBreakingM
|
|||
import com.simibubi.create.content.contraptions.components.actors.HarvesterMovementBehaviour;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity.ContraptionRotationState;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ClientMotionPacket;
|
||||
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity;
|
||||
import com.simibubi.create.foundation.collision.ContinuousOBBCollider.ContinuousSeparationManifold;
|
||||
import com.simibubi.create.foundation.collision.Matrix3d;
|
||||
import com.simibubi.create.foundation.collision.OrientedBB;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
@ -34,6 +36,7 @@ import net.minecraft.server.level.ServerPlayer;
|
|||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.damagesource.EntityDamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -235,11 +238,11 @@ public class ContraptionCollider {
|
|||
.containsKey(pos)) {
|
||||
BlockState blockState = contraption.getBlocks()
|
||||
.get(pos).state;
|
||||
|
||||
|
||||
MovingInteractionBehaviour movingInteractionBehaviour = contraption.interactors.get(pos);
|
||||
if (movingInteractionBehaviour != null)
|
||||
movingInteractionBehaviour.handleEntityCollision(entity, pos, contraptionEntity);
|
||||
|
||||
|
||||
bounce = BlockHelper.getBounceMultiplier(blockState.getBlock());
|
||||
slide = Math.max(0, blockState.getFriction(contraption.world, pos, entity) - .6f);
|
||||
}
|
||||
|
@ -280,6 +283,7 @@ public class ContraptionCollider {
|
|||
.add(0, contraptionMotion.y, 0);
|
||||
if (motionZ != 0 && Math.abs(intersectZ) > horizonalEpsilon && motionZ > 0 == intersectZ < 0)
|
||||
entityMotion = entityMotion.multiply(1, 1, 0);
|
||||
|
||||
}
|
||||
|
||||
if (bounce == 0 && slide > 0 && hasNormal && anyCollision && rotation.hasVerticalRotation()) {
|
||||
|
@ -304,6 +308,29 @@ public class ContraptionCollider {
|
|||
entityPosition.z + allowedMovement.z);
|
||||
entityPosition = entity.position();
|
||||
|
||||
if (contraptionEntity instanceof CarriageContraptionEntity cce && entity.isOnGround()) {
|
||||
if (AllConfigs.SERVER.trains.trainsCauseDamage.get()) {
|
||||
Vec3 diffMotion = contraptionMotion.subtract(entity.getDeltaMovement());
|
||||
if (diffMotion.length() > 0.35f && contraptionMotion.length() > 0.35f) {
|
||||
EntityDamageSource pSource = new EntityDamageSource("create.run_over", contraptionEntity);
|
||||
double damage = diffMotion.length();
|
||||
if (playerType == PlayerType.CLIENT)
|
||||
AllPackets.channel
|
||||
.sendToServer(new TrainCollisionPacket((int) (damage * 16), contraptionEntity.getId()));
|
||||
else
|
||||
entity.hurt(pSource, (int) (damage * 16));
|
||||
if (!(entity instanceof Player p) || !p.isCreative() && !p.isSpectator())
|
||||
entityMotion = entityMotion.add(entity.position()
|
||||
.subtract(contraptionPosition)
|
||||
.multiply(1, 0, 1)
|
||||
.normalize()
|
||||
.add(0, .25, 0)
|
||||
.scale(damage * 4))
|
||||
.add(diffMotion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entity.hurtMarked = true;
|
||||
Vec3 contactPointMotion = Vec3.ZERO;
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity;
|
||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.damagesource.EntityDamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.network.NetworkEvent.Context;
|
||||
|
||||
public class TrainCollisionPacket extends SimplePacketBase {
|
||||
|
||||
int damage;
|
||||
int contraptionEntityId;
|
||||
|
||||
public TrainCollisionPacket(int damage, int contraptionEntityId) {
|
||||
this.damage = damage;
|
||||
this.contraptionEntityId = contraptionEntityId;
|
||||
}
|
||||
|
||||
public TrainCollisionPacket(FriendlyByteBuf buffer) {
|
||||
contraptionEntityId = buffer.readInt();
|
||||
damage = buffer.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buffer) {
|
||||
buffer.writeInt(contraptionEntityId);
|
||||
buffer.writeInt(damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Supplier<Context> context) {
|
||||
Context ctx = context.get();
|
||||
ctx.enqueueWork(() -> {
|
||||
ServerPlayer player = ctx.getSender();
|
||||
Level level = player.level;
|
||||
|
||||
Entity entity = level.getEntity(contraptionEntityId);
|
||||
if (!(entity instanceof CarriageContraptionEntity cce))
|
||||
return;
|
||||
|
||||
player.hurt(new EntityDamageSource("create.run_over", cce), (int) damage);
|
||||
});
|
||||
ctx.setPacketHandled(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -308,6 +308,13 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
|
|||
train.navigation.waitingForSignal = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
if (carriage == null)
|
||||
return Lang.translate("train");
|
||||
return carriage.train.name;
|
||||
}
|
||||
|
||||
double navDistanceTotal = 0;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.foundation.config;
|
|||
|
||||
public class CTrains extends ConfigBase {
|
||||
|
||||
public final ConfigBool trainsCauseDamage = b(true, "trainsCauseDamage", Comments.trainsCauseDamage);
|
||||
public final ConfigFloat trainTopSpeed = f(36, 0, "trainTopSpeed", Comments.mps, Comments.trainTopSpeed);
|
||||
public final ConfigFloat trainTurningTopSpeed =
|
||||
f(18, 0, "trainTurningTopSpeed", Comments.mps, Comments.trainTurningTopSpeed);
|
||||
|
@ -30,6 +31,7 @@ public class CTrains extends ConfigBase {
|
|||
static String trainTopSpeed = "The top speed of any assembled Train.";
|
||||
static String trainTurningTopSpeed = "The top speed of Trains during a turn.";
|
||||
static String trainAcceleration = "The acceleration of any assembled Train.";
|
||||
static String trainsCauseDamage = "Whether moving Trains can hurt colliding mobs and players.";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.function.Supplier;
|
|||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionDisassemblyPacket;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionStallPacket;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.TrainCollisionPacket;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraptionUpdatePacket;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueEffectPacket;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueRemovalPacket;
|
||||
|
@ -132,6 +133,7 @@ public enum AllPackets {
|
|||
PLACE_CURVED_TRACK(PlaceExtendedCurvePacket.class, PlaceExtendedCurvePacket::new, PLAY_TO_SERVER),
|
||||
GLUE_IN_AREA(SuperGlueSelectionPacket.class, SuperGlueSelectionPacket::new, PLAY_TO_SERVER),
|
||||
GLUE_REMOVED(SuperGlueRemovalPacket.class, SuperGlueRemovalPacket::new, PLAY_TO_SERVER),
|
||||
TRAIN_COLLISION(TrainCollisionPacket.class, TrainCollisionPacket::new, PLAY_TO_SERVER),
|
||||
|
||||
// Server to Client
|
||||
SYMMETRY_EFFECT(SymmetryEffectPacket.class, SymmetryEffectPacket::new, PLAY_TO_CLIENT),
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
"death.attack.create.potato_cannon.item": "%1$s was shot by %2$s using %3$s",
|
||||
"death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.cuckoo_clock_explosion.player": "%1$s was blown up by tampered cuckoo clock",
|
||||
"death.attack.create.run_over": "%1$s was run over by %2$s",
|
||||
"create.block.deployer.damage_source_name": "a rogue Deployer",
|
||||
|
||||
"create.block.cart_assembler.invalid": "Place your Cart Assembler on a rail block",
|
||||
|
||||
"create.menu.return": "Return to Menu",
|
||||
|
|
Loading…
Reference in a new issue